Removed is_refcounted and GBoxedInitFunc from

2001-09-10  Alex Larsson  <alexl@redhat.com>

	* gobject/gboxed.[ch]:
	* gobject/gsourceclosure.c:
	Removed is_refcounted and GBoxedInitFunc from
	g_boxed_type_register_static().
This commit is contained in:
Alex Larsson 2001-09-10 16:48:42 +00:00 committed by Alexander Larsson
parent 16fc3b22c0
commit ae2c2ca6c3
11 changed files with 66 additions and 43 deletions

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -1,3 +1,10 @@
2001-09-10 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gutf8.c glib/gstring.c glib/gfileutils.c glib/gmain.c:

View File

@ -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);
}

View File

@ -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 --- */

View File

@ -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;
}