summaryrefslogtreecommitdiff
path: root/src/bin/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-08 15:11:53 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:19 +0100
commit92ad720127d1f7d43378e90c7961682840574cad (patch)
tree50a34e3e783c8e4796695c66d4bf17101eb2d4c7 /src/bin/elua
parent1dcc62c7c2b3e73b31bbd874a8889ab7400dddde (diff)
elua: remove the smart cb wrapper (ffi callbacks work fine for us)
Diffstat (limited to 'src/bin/elua')
-rw-r--r--src/bin/elua/main.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/bin/elua/main.c b/src/bin/elua/main.c
index d5b2f740b3..6aec596e79 100644
--- a/src/bin/elua/main.c
+++ b/src/bin/elua/main.c
@@ -297,29 +297,7 @@ elua_bin_shutdown(Elua_State *es, int c)
297 exit(c); 297 exit(c);
298} 298}
299 299
300static int elua_cb_ref = LUA_REFNIL; 300static Elua_State *elua_state = NULL;
301static Elua_State *elua_state = NULL;
302
303static void
304elua_smart_cb_wrapper(void *data, void *obj EINA_UNUSED, void *einfo EINA_UNUSED)
305{
306 int idx = (size_t)data;
307 lua_rawgeti(elua_state->luastate, LUA_REGISTRYINDEX, elua_cb_ref);
308 lua_rawgeti(elua_state->luastate, -1, idx);
309 lua_call(elua_state->luastate, 0, 0);
310 lua_pop(elua_state->luastate, 1);
311}
312
313static int
314elua_register_callbacks(lua_State *L)
315{
316 union { void (*fptr)(void*, void*, void*); void *ptr; } u;
317 lua_pushvalue(L, 1);
318 elua_cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
319 u.fptr = elua_smart_cb_wrapper;
320 lua_pushlightuserdata(L, u.ptr);
321 return 1;
322}
323 301
324struct Main_Data 302struct Main_Data
325{ 303{
@@ -331,10 +309,9 @@ struct Main_Data
331 309
332const luaL_reg cutillib[] = 310const luaL_reg cutillib[] =
333{ 311{
334 { "init_module" , elua_init_module }, 312 { "init_module", elua_init_module },
335 { "register_callbacks", elua_register_callbacks }, 313 { "popenv" , elua_io_popen },
336 { "popenv" , elua_io_popen }, 314 { NULL , NULL }
337 { NULL , NULL }
338}; 315};
339 316
340static void 317static void