summaryrefslogtreecommitdiff
path: root/ghook.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-10-31 18:57:36 +0000
committerTim Janik <timj@src.gnome.org>1998-10-31 18:57:36 +0000
commite8a920f88d5e6f534f20f04681e5cc33dba8239f (patch)
tree88bb87a9ef0a7e5c0fa413e04c9dda41daf8bac3 /ghook.c
parenta32e40e2c4b62a41777d63d20a0898de4aa58b91 (diff)
downloadglib-e8a920f88d5e6f534f20f04681e5cc33dba8239f.tar.gz
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).
Diffstat (limited to 'ghook.c')
-rw-r--r--ghook.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ghook.c b/ghook.c
index a094a468e..91ab097ac 100644
--- a/ghook.c
+++ b/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)