From: Tim Janik Date: Thu, 8 Oct 1998 06:32:49 +0000 (+0000) Subject: removed functions g_dataset_id_set_destroy and g_datalist_id_set_destroy X-Git-Tag: GLIB_1_1_4~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bee522aa5756de898f10f88e27cc01e89cc39cf2;p=platform%2Fupstream%2Fglib.git removed functions g_dataset_id_set_destroy and g_datalist_id_set_destroy Thu Oct 8 06:47:27 1998 Tim Janik * glib.h: * gdataset.c: removed functions g_dataset_id_set_destroy and g_datalist_id_set_destroy and macros g_dataset_set_destroy and g_datalist_set_destroy. added new functions g_dataset_id_remove_no_notify and g_datalist_id_remove_no_notify plus associated macros g_dataset_remove_no_notify and g_datalist_remove_no_notify, which will remove a certain data portion without invokation of its destroy notifier, this should only be used in very controled circumstances. --- diff --git a/ChangeLog b/ChangeLog index e7db3b0..505ad56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e7db3b0..505ad56 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e7db3b0..505ad56 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index e7db3b0..505ad56 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e7db3b0..505ad56 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e7db3b0..505ad56 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e7db3b0..505ad56 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e7db3b0..505ad56 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +Thu Oct 8 06:47:27 1998 Tim Janik + + * glib.h: + * gdataset.c: removed functions g_dataset_id_set_destroy and + g_datalist_id_set_destroy and macros g_dataset_set_destroy and + g_datalist_set_destroy. + added new functions g_dataset_id_remove_no_notify and + g_datalist_id_remove_no_notify plus associated macros + g_dataset_remove_no_notify and g_datalist_remove_no_notify, which + will remove a certain data portion without invokation of its destroy + notifier, this should only be used in very controled circumstances. + Wed Oct 7 05:31:24 1998 Tim Janik * glib.h: @@ -311,7 +323,7 @@ Mon Aug 24 02:08:56 1998 Tim Janik 1998-08-18: Elliot Lee - . In gmem.c, add the ability to exclude memory chunks from the + * In gmem.c, add the ability to exclude memory chunks from the memory profiling information. Tue Aug 18 18:23:09 PDT 1998 Manish Singh @@ -723,7 +735,7 @@ Wed May 20 05:02:26 1998 Tim Janik g_mem_chunk_new(). (g_chunk_free): new convenience macro to be consistent with g_chunk_new. -Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro +Tue, 19 May 1998 09:00:02 +0200 Paolo Molaro * gcompletion.c: generic functions for completion... @@ -738,8 +750,8 @@ Sun May 17 10:48:27 1998 Tim Janik Fri May 15 22:31:49 1998 Tim Janik * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) - that for some reason didn't produce a compiler wrning on my machine - (is va_end undefined for i386?). + that for some reason didn't produce a compiler warning on my machine + (is va_end defined to nothing for i386?). Fri May 15 12:32:08 1998 rodo diff --git a/gdataset.c b/gdataset.c index cb0ad03..35c7be8 100644 --- a/gdataset.c +++ b/gdataset.c @@ -199,8 +199,11 @@ g_data_set_internal (GData **datalist, /* the GData struct *must* already be unlinked * when invoking the destroy function + * we use (data==NULL && destroy_func!=NULL) as + * a special hint combination to "steal" + * data without destroy notification */ - if (list->destroy_func) + if (list->destroy_func && !destroy_func) list->destroy_func (list->data); if (g_data_cache_length < G_DATA_CACHE_MAX) @@ -277,6 +280,8 @@ g_dataset_id_set_data_full (gconstpointer dataset_location, register GDataset *dataset; g_return_if_fail (dataset_location != NULL); + if (!data) + g_return_if_fail (destroy_func == NULL); if (!key_id) { if (data) @@ -309,6 +314,8 @@ g_datalist_id_set_data_full (GData **datalist, GDestroyNotify destroy_func) { g_return_if_fail (datalist != NULL); + if (!data) + g_return_if_fail (destroy_func == NULL); if (!key_id) { if (data) @@ -321,48 +328,29 @@ g_datalist_id_set_data_full (GData **datalist, } void -g_dataset_id_set_destroy (gconstpointer dataset_location, - GQuark key_id, - GDestroyNotify destroy_func) +g_dataset_id_remove_no_notify (gconstpointer dataset_location, + GQuark key_id) { - register GDataset *dataset; - g_return_if_fail (dataset_location != NULL); - g_return_if_fail (key_id > 0); - if (g_dataset_location_ht) + if (key_id && g_dataset_location_ht) { + GDataset *dataset; + dataset = g_dataset_lookup (dataset_location); if (dataset) - { - register GData *list; - - for (list = dataset->datalist; list; list = list->next) - if (list->id == key_id) - { - list->destroy_func = destroy_func; - break; - } - } + g_data_set_internal (&dataset->datalist, key_id, NULL, (GDestroyNotify) 42, dataset); } } void -g_datalist_id_set_destroy (GData **datalist, - GQuark key_id, - GDestroyNotify destroy_func) +g_datalist_id_remove_no_notify (GData **datalist, + GQuark key_id) { - register GData *list; - g_return_if_fail (datalist != NULL); - g_return_if_fail (key_id > 0); - - for (list = *datalist; list; list = list->next) - if (list->id == key_id) - { - list->destroy_func = destroy_func; - break; - } + + if (key_id) + g_data_set_internal (datalist, key_id, NULL, (GDestroyNotify) 42, NULL); } gpointer diff --git a/glib.h b/glib.h index af32920..fda3fed 100644 --- a/glib.h +++ b/glib.h @@ -1562,34 +1562,33 @@ gchar* g_quark_to_string (GQuark quark); /* Keyed Data List */ -void g_datalist_init (GData **datalist); -void g_datalist_clear (GData **datalist); -gpointer g_datalist_id_get_data (GData **datalist, - GQuark key_id); -void g_datalist_id_set_data_full (GData **datalist, - GQuark key_id, - gpointer data, - GDestroyNotify destroy_func); -void g_datalist_id_set_destroy (GData **datalist, - GQuark key_id, - GDestroyNotify destroy_func); -void g_datalist_foreach (GData **datalist, - GDataForeachFunc func, - gpointer user_data); +void g_datalist_init (GData **datalist); +void g_datalist_clear (GData **datalist); +gpointer g_datalist_id_get_data (GData **datalist, + GQuark key_id); +void g_datalist_id_set_data_full (GData **datalist, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func); +void g_datalist_id_remove_no_notify (GData **datalist, + GQuark key_id); +void g_datalist_foreach (GData **datalist, + GDataForeachFunc func, + gpointer user_data); #define g_datalist_id_set_data(dl, q, d) \ g_datalist_id_set_data_full ((dl), (q), (d), NULL) #define g_datalist_id_remove_data(dl, q) \ g_datalist_id_set_data ((dl), (q), NULL) #define g_datalist_get_data(dl, k) \ - (g_datalist_id_get_data ((dl), g_quark_try_string ((k)))) + (g_datalist_id_get_data ((dl), g_quark_try_string (k))) #define g_datalist_set_data_full(dl, k, d, f) \ - g_datalist_id_set_data_full ((dl), g_quark_from_string ((k)), (d), (f)) -#define g_datalist_set_destroy(dl, k, f) \ - g_datalist_id_set_destroy ((dl), g_quark_try_string ((k)), (f)) + g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) +#define g_datalist_remove_no_notify(dl, k) \ + g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) #define g_datalist_set_data(dl, k, d) \ g_datalist_set_data_full ((dl), (k), (d), NULL) #define g_datalist_remove_data(dl, k) \ - g_datalist_id_set_data ((dl), g_quark_try_string ((k)), NULL) + g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) /* Location Associated Keyed Data @@ -1601,9 +1600,8 @@ void g_dataset_id_set_data_full (gconstpointer dataset_location, GQuark key_id, gpointer data, GDestroyNotify destroy_func); -void g_dataset_id_set_destroy (gconstpointer dataset_location, - GQuark key_id, - GDestroyNotify destroy_func); +void g_dataset_id_remove_no_notify (gconstpointer dataset_location, + GQuark key_id); void g_dataset_foreach (gconstpointer dataset_location, GDataForeachFunc func, gpointer user_data); @@ -1612,15 +1610,15 @@ void g_dataset_foreach (gconstpointer dataset_location, #define g_dataset_id_remove_data(l, k) \ g_dataset_id_set_data ((l), (k), NULL) #define g_dataset_get_data(l, k) \ - (g_dataset_id_get_data ((l), g_quark_try_string ((k)))) + (g_dataset_id_get_data ((l), g_quark_try_string (k))) #define g_dataset_set_data_full(l, k, d, f) \ - g_dataset_id_set_data_full ((l), g_quark_from_string ((k)), (d), (f)) -#define g_dataset_set_destroy(l, k, f) \ - g_dataset_id_set_destroy ((l), g_quark_try_string ((k)), (f)) + g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) +#define g_dataset_remove_no_notify(l, k) \ + g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) #define g_dataset_set_data(l, k, d) \ g_dataset_set_data_full ((l), (k), (d), NULL) #define g_dataset_remove_data(l, k) \ - g_dataset_id_set_data ((l), g_quark_try_string ((k)), NULL) + g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) /* GScanner: Flexible lexical scanner for general purpose. diff --git a/glib/gdataset.c b/glib/gdataset.c index cb0ad03..35c7be8 100644 --- a/glib/gdataset.c +++ b/glib/gdataset.c @@ -199,8 +199,11 @@ g_data_set_internal (GData **datalist, /* the GData struct *must* already be unlinked * when invoking the destroy function + * we use (data==NULL && destroy_func!=NULL) as + * a special hint combination to "steal" + * data without destroy notification */ - if (list->destroy_func) + if (list->destroy_func && !destroy_func) list->destroy_func (list->data); if (g_data_cache_length < G_DATA_CACHE_MAX) @@ -277,6 +280,8 @@ g_dataset_id_set_data_full (gconstpointer dataset_location, register GDataset *dataset; g_return_if_fail (dataset_location != NULL); + if (!data) + g_return_if_fail (destroy_func == NULL); if (!key_id) { if (data) @@ -309,6 +314,8 @@ g_datalist_id_set_data_full (GData **datalist, GDestroyNotify destroy_func) { g_return_if_fail (datalist != NULL); + if (!data) + g_return_if_fail (destroy_func == NULL); if (!key_id) { if (data) @@ -321,48 +328,29 @@ g_datalist_id_set_data_full (GData **datalist, } void -g_dataset_id_set_destroy (gconstpointer dataset_location, - GQuark key_id, - GDestroyNotify destroy_func) +g_dataset_id_remove_no_notify (gconstpointer dataset_location, + GQuark key_id) { - register GDataset *dataset; - g_return_if_fail (dataset_location != NULL); - g_return_if_fail (key_id > 0); - if (g_dataset_location_ht) + if (key_id && g_dataset_location_ht) { + GDataset *dataset; + dataset = g_dataset_lookup (dataset_location); if (dataset) - { - register GData *list; - - for (list = dataset->datalist; list; list = list->next) - if (list->id == key_id) - { - list->destroy_func = destroy_func; - break; - } - } + g_data_set_internal (&dataset->datalist, key_id, NULL, (GDestroyNotify) 42, dataset); } } void -g_datalist_id_set_destroy (GData **datalist, - GQuark key_id, - GDestroyNotify destroy_func) +g_datalist_id_remove_no_notify (GData **datalist, + GQuark key_id) { - register GData *list; - g_return_if_fail (datalist != NULL); - g_return_if_fail (key_id > 0); - - for (list = *datalist; list; list = list->next) - if (list->id == key_id) - { - list->destroy_func = destroy_func; - break; - } + + if (key_id) + g_data_set_internal (datalist, key_id, NULL, (GDestroyNotify) 42, NULL); } gpointer diff --git a/glib/glib.h b/glib/glib.h index af32920..fda3fed 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -1562,34 +1562,33 @@ gchar* g_quark_to_string (GQuark quark); /* Keyed Data List */ -void g_datalist_init (GData **datalist); -void g_datalist_clear (GData **datalist); -gpointer g_datalist_id_get_data (GData **datalist, - GQuark key_id); -void g_datalist_id_set_data_full (GData **datalist, - GQuark key_id, - gpointer data, - GDestroyNotify destroy_func); -void g_datalist_id_set_destroy (GData **datalist, - GQuark key_id, - GDestroyNotify destroy_func); -void g_datalist_foreach (GData **datalist, - GDataForeachFunc func, - gpointer user_data); +void g_datalist_init (GData **datalist); +void g_datalist_clear (GData **datalist); +gpointer g_datalist_id_get_data (GData **datalist, + GQuark key_id); +void g_datalist_id_set_data_full (GData **datalist, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func); +void g_datalist_id_remove_no_notify (GData **datalist, + GQuark key_id); +void g_datalist_foreach (GData **datalist, + GDataForeachFunc func, + gpointer user_data); #define g_datalist_id_set_data(dl, q, d) \ g_datalist_id_set_data_full ((dl), (q), (d), NULL) #define g_datalist_id_remove_data(dl, q) \ g_datalist_id_set_data ((dl), (q), NULL) #define g_datalist_get_data(dl, k) \ - (g_datalist_id_get_data ((dl), g_quark_try_string ((k)))) + (g_datalist_id_get_data ((dl), g_quark_try_string (k))) #define g_datalist_set_data_full(dl, k, d, f) \ - g_datalist_id_set_data_full ((dl), g_quark_from_string ((k)), (d), (f)) -#define g_datalist_set_destroy(dl, k, f) \ - g_datalist_id_set_destroy ((dl), g_quark_try_string ((k)), (f)) + g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) +#define g_datalist_remove_no_notify(dl, k) \ + g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) #define g_datalist_set_data(dl, k, d) \ g_datalist_set_data_full ((dl), (k), (d), NULL) #define g_datalist_remove_data(dl, k) \ - g_datalist_id_set_data ((dl), g_quark_try_string ((k)), NULL) + g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) /* Location Associated Keyed Data @@ -1601,9 +1600,8 @@ void g_dataset_id_set_data_full (gconstpointer dataset_location, GQuark key_id, gpointer data, GDestroyNotify destroy_func); -void g_dataset_id_set_destroy (gconstpointer dataset_location, - GQuark key_id, - GDestroyNotify destroy_func); +void g_dataset_id_remove_no_notify (gconstpointer dataset_location, + GQuark key_id); void g_dataset_foreach (gconstpointer dataset_location, GDataForeachFunc func, gpointer user_data); @@ -1612,15 +1610,15 @@ void g_dataset_foreach (gconstpointer dataset_location, #define g_dataset_id_remove_data(l, k) \ g_dataset_id_set_data ((l), (k), NULL) #define g_dataset_get_data(l, k) \ - (g_dataset_id_get_data ((l), g_quark_try_string ((k)))) + (g_dataset_id_get_data ((l), g_quark_try_string (k))) #define g_dataset_set_data_full(l, k, d, f) \ - g_dataset_id_set_data_full ((l), g_quark_from_string ((k)), (d), (f)) -#define g_dataset_set_destroy(l, k, f) \ - g_dataset_id_set_destroy ((l), g_quark_try_string ((k)), (f)) + g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) +#define g_dataset_remove_no_notify(l, k) \ + g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) #define g_dataset_set_data(l, k, d) \ g_dataset_set_data_full ((l), (k), (d), NULL) #define g_dataset_remove_data(l, k) \ - g_dataset_id_set_data ((l), g_quark_try_string ((k)), NULL) + g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) /* GScanner: Flexible lexical scanner for general purpose.