From ae2c2ca6c3d8b60c1266963c5722e93d9c36b889 Mon Sep 17 00:00:00 2001 From: Alex Larsson Date: Mon, 10 Sep 2001 16:48:42 +0000 Subject: [PATCH] Removed is_refcounted and GBoxedInitFunc from 2001-09-10 Alex Larsson * gobject/gboxed.[ch]: * gobject/gsourceclosure.c: Removed is_refcounted and GBoxedInitFunc from g_boxed_type_register_static(). --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gobject/gboxed.c | 44 ++++++++-------------------------------- gobject/gboxed.h | 5 +---- gobject/gsourceclosure.c | 4 +--- 11 files changed, 66 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index a83c5ba40..1c9d80784 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a83c5ba40..1c9d80784 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a83c5ba40..1c9d80784 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index a83c5ba40..1c9d80784 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a83c5ba40..1c9d80784 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a83c5ba40..1c9d80784 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a83c5ba40..1c9d80784 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a83c5ba40..1c9d80784 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2001-09-10 Alex Larsson + + * gobject/gboxed.[ch]: + * gobject/gsourceclosure.c: + Removed is_refcounted and GBoxedInitFunc from + g_boxed_type_register_static(). + Mon Sep 10 11:42:58 2001 Owen Taylor * glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c: diff --git a/gobject/gboxed.c b/gobject/gboxed.c index e61429aaf..c40011583 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -30,10 +30,8 @@ typedef struct { GType type; - GBoxedInitFunc init; GBoxedCopyFunc copy; GBoxedFreeFunc free; - gboolean is_refcounted; } BoxedNode; @@ -88,18 +86,6 @@ value_free (gpointer boxed) g_free (value); } -static gpointer -value_array_init (void) -{ - return g_value_array_new (0); -} - -static gpointer -gstring_init (void) -{ - return g_string_new (""); -} - static gpointer gstring_copy (gpointer boxed) { @@ -143,38 +129,30 @@ g_boxed_type_init (void) /* sync with gtype.c */ /* boxed: G_TYPE_CLOSURE */ type = g_boxed_type_register_static ("GClosure", - (GBoxedInitFunc) NULL, (GBoxedCopyFunc) g_closure_ref, - (GBoxedFreeFunc) g_closure_unref, - TRUE); + (GBoxedFreeFunc) g_closure_unref); g_assert (type == G_TYPE_CLOSURE); /* boxed: G_TYPE_VALUE */ type = g_boxed_type_register_static ("GValue", - (GBoxedInitFunc) NULL, value_copy, - value_free, - FALSE); + value_free); g_assert (type == G_TYPE_VALUE); /* boxed: G_TYPE_VALUE_ARRAY */ type = g_boxed_type_register_static ("GValueArray", - value_array_init, /* don't allow NULL values */ (GBoxedCopyFunc) g_value_array_copy, - (GBoxedFreeFunc) g_value_array_free, - FALSE); + (GBoxedFreeFunc) g_value_array_free); g_assert (type == G_TYPE_VALUE_ARRAY); /* boxed: G_TYPE_GSTRING * yes, the naming is a bit odd, but GString is obviously not G_TYPE_STRING */ type = g_boxed_type_register_static ("GString", - gstring_init, /* don't allow NULL values */ gstring_copy, - gstring_free, - FALSE); + gstring_free); g_assert (type == G_TYPE_GSTRING); } @@ -185,7 +163,7 @@ boxed_proxy_value_init (GValue *value) key.type = G_VALUE_TYPE (value); node = g_bsearch_array_lookup (&boxed_bsa, &key); - value->data[0].v_pointer = node->init ? node->init () : NULL; + value->data[0].v_pointer = NULL; } static void @@ -234,13 +212,11 @@ boxed_proxy_collect_value (GValue *value, key.type = G_VALUE_TYPE (value); node = g_bsearch_array_lookup (&boxed_bsa, &key); - /* for NULL values, we have to call GBoxedInitFunc */ if (!collect_values[0].v_pointer) - value->data[0].v_pointer = node->init ? node->init () : NULL; + value->data[0].v_pointer = NULL; else { - /* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */ - if (!node->is_refcounted && (collect_flags & G_VALUE_NOCOPY_CONTENTS)) + if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { value->data[0].v_pointer = collect_values[0].v_pointer; value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS; @@ -281,10 +257,8 @@ boxed_proxy_lcopy_value (const GValue *value, GType g_boxed_type_register_static (const gchar *name, - GBoxedInitFunc boxed_init, GBoxedCopyFunc boxed_copy, - GBoxedFreeFunc boxed_free, - gboolean is_refcounted) + GBoxedFreeFunc boxed_free) { static const GTypeValueTable vtable = { boxed_proxy_value_init, @@ -323,10 +297,8 @@ g_boxed_type_register_static (const gchar *name, BoxedNode key; key.type = type; - key.init = boxed_init; key.copy = boxed_copy; key.free = boxed_free; - key.is_refcounted = is_refcounted != FALSE; g_bsearch_array_insert (&boxed_bsa, &key, TRUE); } diff --git a/gobject/gboxed.h b/gobject/gboxed.h index 1ab9f7ee4..5b9f63bc1 100644 --- a/gobject/gboxed.h +++ b/gobject/gboxed.h @@ -29,7 +29,6 @@ G_BEGIN_DECLS /* --- typedefs --- */ -typedef gpointer (*GBoxedInitFunc) (void); typedef gpointer (*GBoxedCopyFunc) (gpointer boxed); typedef void (*GBoxedFreeFunc) (gpointer boxed); @@ -49,10 +48,8 @@ gpointer g_value_dup_boxed (const GValue *value); /* --- convenience --- */ GType g_boxed_type_register_static (const gchar *name, - GBoxedInitFunc boxed_init, GBoxedCopyFunc boxed_copy, - GBoxedFreeFunc boxed_free, - gboolean is_refcounted); + GBoxedFreeFunc boxed_free); /* --- marshaller specific --- */ diff --git a/gobject/gsourceclosure.c b/gobject/gsourceclosure.c index ffb9e99cd..744b91cdb 100644 --- a/gobject/gsourceclosure.c +++ b/gobject/gsourceclosure.c @@ -31,10 +31,8 @@ g_io_channel_get_type (void) if (our_type == 0) our_type = g_boxed_type_register_static ("GIOChannel", - NULL, (GBoxedCopyFunc) g_io_channel_ref, - (GBoxedFreeFunc) g_io_channel_unref, - FALSE); + (GBoxedFreeFunc) g_io_channel_unref); return our_type; } -- 2.34.1