summaryrefslogtreecommitdiff
path: root/src/lib/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-09 11:06:48 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:19 +0100
commite4baa1bc124b7706b2ccc04e01377075ab313a2e (patch)
tree5957c2ea100ffda6474ff5011b0a12dcaad28775 /src/lib/elua
parent01aecbe273685f6afd459a3dabb249061b839d1a (diff)
elua lib: use eina safety checks
Diffstat (limited to 'src/lib/elua')
-rw-r--r--src/lib/elua/elua.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index 3446ac4cd2..e5a8387ff2 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -92,7 +92,7 @@ EAPI void
92elua_state_dirs_set(Elua_State *es, const char *core, const char *mods, 92elua_state_dirs_set(Elua_State *es, const char *core, const char *mods,
93 const char *apps) 93 const char *apps)
94{ 94{
95 if (!es) return; 95 EINA_SAFETY_ON_NULL_RETURN(es);
96 if (core) es->coredir = eina_stringshare_add(core); 96 if (core) es->coredir = eina_stringshare_add(core);
97 if (mods) es->moddir = eina_stringshare_add(mods); 97 if (mods) es->moddir = eina_stringshare_add(mods);
98 if (apps) es->appsdir = eina_stringshare_add(apps); 98 if (apps) es->appsdir = eina_stringshare_add(apps);
@@ -101,6 +101,7 @@ elua_state_dirs_set(Elua_State *es, const char *core, const char *mods,
101EAPI Elua_State * 101EAPI Elua_State *
102elua_state_from_lua_get(lua_State *L) 102elua_state_from_lua_get(lua_State *L)
103{ 103{
104 EINA_SAFETY_ON_NULL_RETURN_VAL(L, NULL);
104 lua_getfield(L, LUA_REGISTRYINDEX, "elua_ptr"); 105 lua_getfield(L, LUA_REGISTRYINDEX, "elua_ptr");
105 if (!lua_isnil(L, -1)) 106 if (!lua_isnil(L, -1))
106 { 107 {
@@ -121,7 +122,7 @@ _elua_errmsg(const char *pname, const char *msg)
121EAPI int 122EAPI int
122elua_report_error(Elua_State *es, const char *pname, int status) 123elua_report_error(Elua_State *es, const char *pname, int status)
123{ 124{
124 if (!es || !es->luastate) return status; 125 EINA_SAFETY_ON_FALSE_RETURN_VAL(es && es->luastate, status);
125 if (status && !lua_isnil(es->luastate, -1)) 126 if (status && !lua_isnil(es->luastate, -1))
126 { 127 {
127 const char *msg = lua_tostring(es->luastate, -1); 128 const char *msg = lua_tostring(es->luastate, -1);