Removed is_refcounted and GBoxedInitFunc from
authorAlex Larsson <alexl@redhat.com>
Mon, 10 Sep 2001 16:48:42 +0000 (16:48 +0000)
committerAlexander Larsson <alexl@src.gnome.org>
Mon, 10 Sep 2001 16:48:42 +0000 (16:48 +0000)
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().

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gobject/gboxed.c
gobject/gboxed.h
gobject/gsourceclosure.c

index a83c5ba..1c9d807 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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: 
index a83c5ba..1c9d807 100644 (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: 
index a83c5ba..1c9d807 100644 (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: 
index a83c5ba..1c9d807 100644 (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: 
index a83c5ba..1c9d807 100644 (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: 
index a83c5ba..1c9d807 100644 (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: 
index a83c5ba..1c9d807 100644 (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: 
index a83c5ba..1c9d807 100644 (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: 
index e61429a..c400115 100644 (file)
 typedef struct
 {
   GType                 type;
-  GBoxedInitFunc init;
   GBoxedCopyFunc copy;
   GBoxedFreeFunc free;
-  gboolean      is_refcounted;
 } BoxedNode;
 
 
@@ -89,18 +87,6 @@ value_free (gpointer boxed)
 }
 
 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)
 {
   const GString *src_gstring = 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);
     }
 
index 1ab9f7e..5b9f63b 100644 (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 --- */
index ffb9e99..744b91c 100644 (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;
 }