From: Vladimír Čunát Date: Fri, 5 Apr 2019 13:24:57 +0000 (+0200) Subject: lua event.*: convert light userdata to full X-Git-Tag: v4.1.0~21^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc4b2d3a7f1baa54c7c8997655507deafbc4ea78;p=thirdparty%2Fknot-resolver.git lua event.*: convert light userdata to full They're a bit more expensive, but we won't want lots of events anyway, so I decided to do a simple conversion. --- diff --git a/daemon/bindings/event.c b/daemon/bindings/event.c index 5a4ba633f..32723a118 100644 --- a/daemon/bindings/event.c +++ b/daemon/bindings/event.c @@ -87,7 +87,7 @@ static int event_sched(lua_State *L, unsigned timeout, unsigned repeat) lua_newtable(L); lua_pushvalue(L, 2); lua_rawseti(L, -2, 1); - lua_pushlightuserdata(L, timer); + lua_pushpointer(L, timer); lua_rawseti(L, -2, 2); int ref = luaL_ref(L, LUA_REGISTRYINDEX); @@ -132,7 +132,7 @@ static int event_cancel(lua_State *L) /* Close the timer */ lua_rawgeti(L, -1, 2); - uv_handle_t *timer = lua_touserdata(L, -1); + uv_handle_t *timer = *(uv_handle_t **)lua_touserdata(L, -1); if (!uv_is_closing(timer)) { uv_close(timer, (uv_close_cb) event_free); } @@ -155,7 +155,7 @@ static int event_reschedule(lua_State *L) /* Reschedule the timer */ lua_rawgeti(L, -1, 2); - uv_handle_t *timer = lua_touserdata(L, -1); + uv_handle_t *timer = *(uv_handle_t **)lua_touserdata(L, -1); if (!uv_is_closing(timer)) { if (uv_is_active(timer)) { uv_timer_stop((uv_timer_t *)timer); @@ -197,7 +197,7 @@ static int event_fdwatch(lua_State *L) lua_newtable(L); lua_pushvalue(L, 2); lua_rawseti(L, -2, 1); - lua_pushlightuserdata(L, handle); + lua_pushpointer(L, handle); lua_rawseti(L, -2, 2); int ref = luaL_ref(L, LUA_REGISTRYINDEX);