luaobject: use object header and standard gc everywhere
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
6b24af7238
commit
c95ba76d2f
3
button.c
3
button.c
|
@ -40,10 +40,9 @@ static int
|
|||
luaA_button_gc(lua_State *L)
|
||||
{
|
||||
button_t *button = luaL_checkudata(L, 1, "button");
|
||||
luaA_ref_array_wipe(&button->refs);
|
||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, button->press);
|
||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, button->release);
|
||||
return 0;
|
||||
return luaA_object_gc(L);
|
||||
}
|
||||
|
||||
/** Create a new mouse button bindings.
|
||||
|
|
3
button.h
3
button.h
|
@ -27,8 +27,7 @@
|
|||
/** Mouse buttons bindings */
|
||||
struct button_t
|
||||
{
|
||||
/** Lua references */
|
||||
luaA_ref_array_t refs;
|
||||
LUA_OBJECT_HEADER
|
||||
/** Key modifiers */
|
||||
uint16_t mod;
|
||||
/** Mouse button number */
|
||||
|
|
3
client.c
3
client.c
|
@ -51,7 +51,6 @@ static int
|
|||
luaA_client_gc(lua_State *L)
|
||||
{
|
||||
client_t *c = luaL_checkudata(L, 1, "client");
|
||||
luaA_ref_array_wipe(&c->refs);
|
||||
button_array_wipe(&c->buttons);
|
||||
image_unref(L, c->icon);
|
||||
p_delete(&c->class);
|
||||
|
@ -59,7 +58,7 @@ luaA_client_gc(lua_State *L)
|
|||
p_delete(&c->instance);
|
||||
p_delete(&c->icon_name);
|
||||
p_delete(&c->name);
|
||||
return 0;
|
||||
return luaA_object_gc(L);
|
||||
}
|
||||
|
||||
/** Change the clients urgency flag.
|
||||
|
|
3
client.h
3
client.h
|
@ -67,8 +67,7 @@ typedef struct
|
|||
/** client_t type */
|
||||
struct client_t
|
||||
{
|
||||
/** Lua reference counter */
|
||||
luaA_ref_array_t refs;
|
||||
LUA_OBJECT_HEADER
|
||||
/** Valid, or not ? */
|
||||
bool invalid;
|
||||
/** Client name */
|
||||
|
|
3
image.c
3
image.c
|
@ -28,11 +28,10 @@ static int
|
|||
luaA_image_gc(lua_State *L)
|
||||
{
|
||||
image_t *p = luaL_checkudata(L, 1, "image");
|
||||
luaA_ref_array_wipe(&p->refs);
|
||||
imlib_context_set_image(p->image);
|
||||
imlib_free_image();
|
||||
p_delete(&p->data);
|
||||
return 0;
|
||||
return luaA_object_gc(L);
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
|
3
image.h
3
image.h
|
@ -29,8 +29,7 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
/** Lua references */
|
||||
luaA_ref_array_t refs;
|
||||
LUA_OBJECT_HEADER
|
||||
/** Imlib2 image */
|
||||
Imlib_Image image;
|
||||
/** Image data */
|
||||
|
|
3
key.c
3
key.c
|
@ -50,10 +50,9 @@ static int
|
|||
luaA_key_gc(lua_State *L)
|
||||
{
|
||||
keyb_t *kbp = luaL_checkudata(L, 1, "key");
|
||||
luaA_ref_array_wipe(&kbp->refs);
|
||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, kbp->press);
|
||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, kbp->release);
|
||||
return 0;
|
||||
return luaA_object_gc(L);
|
||||
}
|
||||
|
||||
/** Grab key on a window.
|
||||
|
|
3
key.h
3
key.h
|
@ -26,8 +26,7 @@
|
|||
|
||||
typedef struct keyb_t
|
||||
{
|
||||
/** Lua references */
|
||||
luaA_ref_array_t refs;
|
||||
LUA_OBJECT_HEADER
|
||||
/** Key modifier */
|
||||
uint16_t mod;
|
||||
/** Keysym */
|
||||
|
|
3
tag.c
3
tag.c
|
@ -41,10 +41,9 @@ static int
|
|||
luaA_tag_gc(lua_State *L)
|
||||
{
|
||||
tag_t *tag = luaL_checkudata(L, 1, "tag");
|
||||
luaA_ref_array_wipe(&tag->refs);
|
||||
client_array_wipe(&tag->clients);
|
||||
p_delete(&tag->name);
|
||||
return 0;
|
||||
return luaA_object_gc(L);
|
||||
}
|
||||
|
||||
/** View or unview a tag.
|
||||
|
|
3
tag.h
3
tag.h
|
@ -27,8 +27,7 @@
|
|||
/** Tag type */
|
||||
struct tag
|
||||
{
|
||||
/** Lua references count */
|
||||
luaA_ref_array_t refs;
|
||||
LUA_OBJECT_HEADER
|
||||
/** Tag name */
|
||||
char *name;
|
||||
/** Screen */
|
||||
|
|
3
wibox.c
3
wibox.c
|
@ -38,7 +38,6 @@ static int
|
|||
luaA_wibox_gc(lua_State *L)
|
||||
{
|
||||
wibox_t *wibox = luaL_checkudata(L, 1, "wibox");
|
||||
luaA_ref_array_wipe(&wibox->refs);
|
||||
p_delete(&wibox->cursor);
|
||||
simplewindow_wipe(&wibox->sw);
|
||||
button_array_wipe(&wibox->buttons);
|
||||
|
@ -47,7 +46,7 @@ luaA_wibox_gc(lua_State *L)
|
|||
luaL_unref(L, LUA_REGISTRYINDEX, wibox->mouse_enter);
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, wibox->mouse_leave);
|
||||
widget_node_array_wipe(&wibox->widgets);
|
||||
return 0;
|
||||
return luaA_object_gc(L);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
3
wibox.h
3
wibox.h
|
@ -35,8 +35,7 @@ typedef enum
|
|||
/** Wibox type */
|
||||
struct wibox_t
|
||||
{
|
||||
/** Lua references */
|
||||
luaA_ref_array_t refs;
|
||||
LUA_OBJECT_HEADER
|
||||
/** Ontop */
|
||||
bool ontop;
|
||||
/** Visible */
|
||||
|
|
3
widget.c
3
widget.c
|
@ -44,13 +44,12 @@ static int
|
|||
luaA_widget_gc(lua_State *L)
|
||||
{
|
||||
widget_t *widget = luaL_checkudata(L, 1, "widget");
|
||||
luaA_ref_array_wipe(&widget->refs);
|
||||
if(widget->destructor)
|
||||
widget->destructor(widget);
|
||||
button_array_wipe(&widget->buttons);
|
||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, widget->mouse_enter);
|
||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, widget->mouse_leave);
|
||||
return 0;
|
||||
return luaA_object_gc(L);
|
||||
}
|
||||
|
||||
/** Delete a widget node structure.
|
||||
|
|
Loading…
Reference in New Issue