diff options
author | Tim Janik <timj@gtk.org> | 2001-03-18 04:44:38 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2001-03-18 04:44:38 +0000 |
commit | 45fb71949a0c0e27fe8d0948b345334f61a5c924 (patch) | |
tree | 1044cb22a18c41a892fc7a1d31362d59c0f0ad82 /gobject/gboxed.c | |
parent | 1d5b01bb5286277859d354a46c99fcee0a56113a (diff) |
removed archaic gpointer derived_data; relict and added a GData member
Wed Mar 14 18:46:54 2001 Tim Janik <timj@gtk.org>
* gscanner.[hc]: removed archaic gpointer derived_data; relict and
added a GData member instead.
* glist.[hc]: added g_list_remove_all().
* gslist.[hc]: added g_slist_remove_all().
Sat Mar 17 23:18:36 2001 Tim Janik <timj@gtk.org>
* gobject.c (g_object_get_property): minor bug-fix.
* gbsearcharray.[hc]: provide a macro for static initialization and
functions g_bsearch_array_new() and g_bsearch_array_destroy() for
dynamic allocations.
* gboxed.c: introduce G_TYPE_GSTRING, boxed type for GString.
* gclosure.[hc]: naming corrections.
Fri Mar 9 16:42:08 2001 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: moved g_strdup_value_contents() into this file as
a public function (was static in gobject.c before). it's a bit odd
to have that function here, especially since it requires extra includes,
but then it doesn't very well fit somewhere else either.
* gparamspecs.c: added default/max/min checks to param spec creation
functions.
Diffstat (limited to 'gobject/gboxed.c')
-rw-r--r-- | gobject/gboxed.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 7dd240b7d..2924622fd 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -43,7 +43,7 @@ static gint boxed_nodes_cmp (gconstpointer p1, /* --- variables --- */ -static GBSearchArray boxed_bsa = { boxed_nodes_cmp, sizeof (BoxedNode), 0, 0, NULL }; +static GBSearchArray boxed_bsa = G_STATIC_BSEARCH_ARRAY_INIT (sizeof (BoxedNode), boxed_nodes_cmp, 0); /* --- functions --- */ @@ -94,6 +94,28 @@ 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) +{ + const GString *src_gstring = boxed; + + return g_string_new_len (src_gstring->str, src_gstring->len); +} + +static void +gstring_free (gpointer boxed) +{ + GString *gstring = boxed; + + g_string_free (gstring, TRUE); +} + void g_boxed_type_init (void) /* sync with gtype.c */ { @@ -144,6 +166,16 @@ g_boxed_type_init (void) /* sync with gtype.c */ (GBoxedFreeFunc) g_value_array_free, FALSE); 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); + g_assert (type == G_TYPE_GSTRING); } static void |