mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-27 11:29:02 +02:00
removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. added macros
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org> * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. added macros G_STRUCT_OFFSET(), G_STRUCT_MEMBER_P() and G_STRUCT_MEMBER() for handling structure fields through their offsets. (struct _GHookList): added a hook_free function member, that can be used to free additional fields in derived hook structures. g_hook_free(): if hook_list->hook_free != NULL, call this function prior to freeing the hook. (this functionality should have been there in the first place, it just got forgotten as an implementation detail).
This commit is contained in:
6
ghook.c
6
ghook.c
@@ -42,6 +42,7 @@ g_hook_list_init (GHookList *hook_list,
|
||||
hook_size,
|
||||
hook_size * G_HOOKS_PREALLOC,
|
||||
G_ALLOC_AND_FREE);
|
||||
hook_list->hook_free = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -105,6 +106,9 @@ g_hook_free (GHookList *hook_list,
|
||||
g_return_if_fail (hook_list->is_setup);
|
||||
g_return_if_fail (hook != NULL);
|
||||
g_return_if_fail (G_HOOK_IS_UNLINKED (hook));
|
||||
|
||||
if (hook_list->hook_free)
|
||||
hook_list->hook_free (hook_list, hook);
|
||||
|
||||
g_chunk_free (hook, hook_list->hook_memchunk);
|
||||
}
|
||||
@@ -176,7 +180,7 @@ g_hook_unref (GHookList *hook_list,
|
||||
}
|
||||
hook->prev = NULL;
|
||||
|
||||
g_chunk_free (hook, hook_list->hook_memchunk);
|
||||
g_hook_free (hook_list, hook);
|
||||
|
||||
if (!hook_list->hooks &&
|
||||
!hook_list->is_setup)
|
||||
|
Reference in New Issue
Block a user