diff --git a/common/luaobject.c b/common/luaobject.c index 59628298..118be3a3 100644 --- a/common/luaobject.c +++ b/common/luaobject.c @@ -100,7 +100,7 @@ luaA_object_incref(lua_State *L, int tud, int oud) * \return A pointer to the object. */ void -luaA_object_decref(lua_State *L, int tud, void *pointer) +luaA_object_decref(lua_State *L, int tud, const void *pointer) { if(!pointer) return; @@ -109,7 +109,7 @@ luaA_object_decref(lua_State *L, int tud, void *pointer) /* Get the metatable */ lua_getmetatable(L, tud); /* Push the pointer (key) */ - lua_pushlightuserdata(L, pointer); + lua_pushlightuserdata(L, (void *) pointer); /* Get the number of references */ lua_rawget(L, -2); /* Get the number of references and decrement it */ @@ -127,7 +127,7 @@ luaA_object_decref(lua_State *L, int tud, void *pointer) } lua_pop(L, 1); /* Push the pointer (key) */ - lua_pushlightuserdata(L, pointer); + lua_pushlightuserdata(L, (void *) pointer); /* Hasn't the ref reached 0? */ if(count) lua_pushinteger(L, count); @@ -143,7 +143,7 @@ luaA_object_decref(lua_State *L, int tud, void *pointer) if(!count) { /* Yes? So remove it from table */ - lua_pushlightuserdata(L, pointer); + lua_pushlightuserdata(L, (void *) pointer); /* Push nil as value */ lua_pushnil(L); /* table[pointer] = nil */ @@ -222,7 +222,7 @@ signal_object_emit(lua_State *L, signal_array_t *arr, const char *name, int narg /* Push all functions and then execute, because this list can change * while executing funcs. */ foreach(func, sigfound->sigfuncs) - luaA_object_push(L, (void *) *func); + luaA_object_push(L, *func); for(int i = 0; i < nbfunc; i++) { @@ -267,7 +267,7 @@ luaA_object_emit_signal(lua_State *L, int oud, /* Push all functions and then execute, because this list can change * while executing funcs. */ foreach(func, sigfound->sigfuncs) - luaA_object_push_item(L, oud_abs, (void *) *func); + luaA_object_push_item(L, oud_abs, *func); for(int i = 0; i < nbfunc; i++) { diff --git a/common/luaobject.h b/common/luaobject.h index 09b389af..f3154438 100644 --- a/common/luaobject.h +++ b/common/luaobject.h @@ -30,7 +30,7 @@ int luaA_settype(lua_State *, lua_class_t *); void luaA_object_setup(lua_State *); void * luaA_object_incref(lua_State *, int, int); -void luaA_object_decref(lua_State *, int, void *); +void luaA_object_decref(lua_State *, int, const void *); /** Store an item in the environment table of an object. * \param L The Lua VM state. @@ -72,12 +72,12 @@ luaA_object_unref_item(lua_State *L, int ud, void *pointer) * \return The number of element pushed on stack. */ static inline int -luaA_object_push_item(lua_State *L, int ud, void *pointer) +luaA_object_push_item(lua_State *L, int ud, const void *pointer) { /* Get env table of the object */ luaA_getuservalue(L, ud); /* Push key */ - lua_pushlightuserdata(L, pointer); + lua_pushlightuserdata(L, (void *) pointer); /* Get env.pointer */ lua_rawget(L, -2); /* Remove env table */ @@ -127,7 +127,7 @@ luaA_object_ref_class(lua_State *L, int oud, lua_class_t *class) * \param oud The object index on the stack. */ static inline void -luaA_object_unref(lua_State *L, void *pointer) +luaA_object_unref(lua_State *L, const void *pointer) { luaA_object_registry_push(L); luaA_object_decref(L, -1, pointer); @@ -140,10 +140,10 @@ luaA_object_unref(lua_State *L, void *pointer) * \return The number of element pushed on stack. */ static inline int -luaA_object_push(lua_State *L, void *pointer) +luaA_object_push(lua_State *L, const void *pointer) { luaA_object_registry_push(L); - lua_pushlightuserdata(L, pointer); + lua_pushlightuserdata(L, (void *) pointer); lua_rawget(L, -2); lua_remove(L, -2); return 1; diff --git a/dbus.c b/dbus.c index 99d37a49..5bc7e93b 100644 --- a/dbus.c +++ b/dbus.c @@ -785,7 +785,7 @@ luaA_dbus_disconnect_signal(lua_State *L) luaA_checkfunction(L, 2); const void *func = lua_topointer(L, 2); signal_disconnect(&dbus_signals, name, func); - luaA_object_unref(L, (void *) func); + luaA_object_unref(L, func); return 0; }