]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lua event.*: convert light userdata to full
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 5 Apr 2019 13:24:57 +0000 (15:24 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 13 Jun 2019 13:03:15 +0000 (15:03 +0200)
They're a bit more expensive, but we won't want lots of events anyway,
so I decided to do a simple conversion.

daemon/bindings/event.c

index 5a4ba633f13cdf3903c5ce5e5b855845ff4b3b2f..32723a1186c249754cc67489ad248aa678008d1f 100644 (file)
@@ -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);