summaryrefslogtreecommitdiff
path: root/src/lib/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-04-27 11:34:29 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:23 +0100
commit093c7aa596122177cda128236dd42df0650075f6 (patch)
treea60c02e7ddebfebd06495c9646804221c0b2df9b /src/lib/elua
parentdb66fe62551c170da81b071c0055b3b3dd4159da (diff)
elua lib: remove unnecessary checks (always initialized)
Diffstat (limited to 'src/lib/elua')
-rw-r--r--src/lib/elua/elua.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index 76cafb1ea6..be85d94d71 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -194,7 +194,6 @@ EAPI Eina_Bool
194elua_state_require_ref_push(Elua_State *es) 194elua_state_require_ref_push(Elua_State *es)
195{ 195{
196 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE); 196 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
197 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
198 EINA_SAFETY_ON_FALSE_RETURN_VAL(es->requireref != LUA_REFNIL, EINA_FALSE); 197 EINA_SAFETY_ON_FALSE_RETURN_VAL(es->requireref != LUA_REFNIL, EINA_FALSE);
199 lua_rawgeti(es->luastate, LUA_REGISTRYINDEX, es->requireref); 198 lua_rawgeti(es->luastate, LUA_REGISTRYINDEX, es->requireref);
200 return EINA_TRUE; 199 return EINA_TRUE;
@@ -204,7 +203,6 @@ EAPI Eina_Bool
204elua_state_appload_ref_push(Elua_State *es) 203elua_state_appload_ref_push(Elua_State *es)
205{ 204{
206 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE); 205 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
207 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
208 EINA_SAFETY_ON_FALSE_RETURN_VAL(es->apploadref != LUA_REFNIL, EINA_FALSE); 206 EINA_SAFETY_ON_FALSE_RETURN_VAL(es->apploadref != LUA_REFNIL, EINA_FALSE);
209 lua_rawgeti(es->luastate, LUA_REGISTRYINDEX, es->apploadref); 207 lua_rawgeti(es->luastate, LUA_REGISTRYINDEX, es->apploadref);
210 return EINA_TRUE; 208 return EINA_TRUE;
@@ -276,7 +274,6 @@ _elua_state_i18n_setup(const Elua_State *es)
276#endif 274#endif
277 char buf[PATH_MAX]; 275 char buf[PATH_MAX];
278 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE); 276 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
279 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
280 EINA_SAFETY_ON_NULL_RETURN_VAL(es->coredir, EINA_FALSE); 277 EINA_SAFETY_ON_NULL_RETURN_VAL(es->coredir, EINA_FALSE);
281 EINA_SAFETY_ON_NULL_RETURN_VAL(es->progname, EINA_FALSE); 278 EINA_SAFETY_ON_NULL_RETURN_VAL(es->progname, EINA_FALSE);
282 snprintf(buf, sizeof(buf), "%s/gettext.lua", es->coredir); 279 snprintf(buf, sizeof(buf), "%s/gettext.lua", es->coredir);
@@ -309,7 +306,6 @@ _elua_state_modules_setup(const Elua_State *es)
309{ 306{
310 char buf[PATH_MAX]; 307 char buf[PATH_MAX];
311 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE); 308 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
312 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
313 EINA_SAFETY_ON_NULL_RETURN_VAL(es->coredir, EINA_FALSE); 309 EINA_SAFETY_ON_NULL_RETURN_VAL(es->coredir, EINA_FALSE);
314 EINA_SAFETY_ON_NULL_RETURN_VAL(es->progname, EINA_FALSE); 310 EINA_SAFETY_ON_NULL_RETURN_VAL(es->progname, EINA_FALSE);
315 snprintf(buf, sizeof(buf), "%s/module.lua", es->coredir); 311 snprintf(buf, sizeof(buf), "%s/module.lua", es->coredir);
@@ -436,7 +432,6 @@ _elua_docall(Elua_State *es, int narg, int nret)
436{ 432{
437 int status; 433 int status;
438 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1); 434 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1);
439 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, -1);
440 int bs = lua_gettop(es->luastate) - narg; 435 int bs = lua_gettop(es->luastate) - narg;
441 lua_pushcfunction(es->luastate, _elua_traceback); 436 lua_pushcfunction(es->luastate, _elua_traceback);
442 lua_insert(es->luastate, bs); 437 lua_insert(es->luastate, bs);
@@ -453,7 +448,6 @@ _elua_getargs(Elua_State *es, int argc, char **argv, int n)
453 int i; 448 int i;
454 int narg = argc - (n + 1); 449 int narg = argc - (n + 1);
455 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1); 450 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1);
456 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, -1);
457 luaL_checkstack(es->luastate, narg + 3, "too many arguments to script"); 451 luaL_checkstack(es->luastate, narg + 3, "too many arguments to script");
458 for (i = n + 1; i < argc; ++i) 452 for (i = n + 1; i < argc; ++i)
459 { 453 {
@@ -472,7 +466,6 @@ EAPI Eina_Bool
472elua_util_require(Elua_State *es, const char *libname) 466elua_util_require(Elua_State *es, const char *libname)
473{ 467{
474 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE); 468 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
475 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
476 if (!elua_state_require_ref_push(es)) 469 if (!elua_state_require_ref_push(es))
477 { 470 {
478 /* store stuff until things are correctly set up */ 471 /* store stuff until things are correctly set up */
@@ -487,7 +480,6 @@ EAPI Eina_Bool
487elua_util_file_run(Elua_State *es, const char *fname) 480elua_util_file_run(Elua_State *es, const char *fname)
488{ 481{
489 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE); 482 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
490 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
491 return !elua_util_error_report(es, elua_io_loadfile(es, fname) 483 return !elua_util_error_report(es, elua_io_loadfile(es, fname)
492 || _elua_docall(es, 0, 1)); 484 || _elua_docall(es, 0, 1));
493} 485}
@@ -496,7 +488,6 @@ EAPI Eina_Bool
496elua_util_string_run(Elua_State *es, const char *chunk, const char *chname) 488elua_util_string_run(Elua_State *es, const char *chunk, const char *chname)
497{ 489{
498 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE); 490 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
499 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
500 return !elua_util_error_report(es, luaL_loadbuffer(es->luastate, chunk, 491 return !elua_util_error_report(es, luaL_loadbuffer(es->luastate, chunk,
501 strlen(chunk), chname) 492 strlen(chunk), chname)
502 || _elua_docall(es, 0, 0)); 493 || _elua_docall(es, 0, 0));
@@ -506,7 +497,6 @@ EAPI int
506elua_util_app_load(Elua_State *es, const char *appname) 497elua_util_app_load(Elua_State *es, const char *appname)
507{ 498{
508 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1); 499 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1);
509 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, -1);
510 EINA_SAFETY_ON_FALSE_RETURN_VAL(elua_state_appload_ref_push(es), -1); 500 EINA_SAFETY_ON_FALSE_RETURN_VAL(elua_state_appload_ref_push(es), -1);
511 lua_pushstring(es->luastate, appname); 501 lua_pushstring(es->luastate, appname);
512 lua_call(es->luastate, 1, 2); 502 lua_call(es->luastate, 1, 2);
@@ -526,7 +516,6 @@ elua_util_script_run(Elua_State *es, int argc, char **argv, int n, int *quit)
526 const char *fname; 516 const char *fname;
527 EINA_SAFETY_ON_FALSE_RETURN_VAL(n < argc, -1); 517 EINA_SAFETY_ON_FALSE_RETURN_VAL(n < argc, -1);
528 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1); 518 EINA_SAFETY_ON_NULL_RETURN_VAL(es, -1);
529 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, -1);
530 fname = argv[n]; 519 fname = argv[n];
531 narg = _elua_getargs(es, argc, argv, n); 520 narg = _elua_getargs(es, argc, argv, n);
532 lua_setglobal(es->luastate, "arg"); 521 lua_setglobal(es->luastate, "arg");
@@ -567,7 +556,7 @@ _elua_errmsg(const char *pname, const char *msg)
567EAPI int 556EAPI int
568elua_util_error_report(const Elua_State *es, int status) 557elua_util_error_report(const Elua_State *es, int status)
569{ 558{
570 EINA_SAFETY_ON_FALSE_RETURN_VAL(es && es->luastate, status); 559 EINA_SAFETY_ON_FALSE_RETURN_VAL(es, status);
571 if (status && !lua_isnil(es->luastate, -1)) 560 if (status && !lua_isnil(es->luastate, -1))
572 { 561 {
573 const char *msg = lua_tostring(es->luastate, -1); 562 const char *msg = lua_tostring(es->luastate, -1);