use g_str_hash() algorithm to generate hashes.
authorTim Janik <timj@gtk.org>
Thu, 10 May 2001 13:58:40 +0000 (13:58 +0000)
committerTim Janik <timj@src.gnome.org>
Thu, 10 May 2001 13:58:40 +0000 (13:58 +0000)
Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>

        * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
        to generate hashes.

        * gmem.c (standard_calloc): free() doesn't return a value
        (Mark Murnane).

Thu May 10 14:00:48 2001  Tim Janik  <timj@gtk.org>

        * gparamspecs.[hc]: removed g_param_spec_stringc() in lack of
        evidence of public need.

        * gsignal.h: added g_signal_disconnect_by_func(),
        g_signal_block_by_func() and g_signal_unblock_by_func() convenience
        macros as per owen's request.

        * gtype.c (SIZEOF_FUNDAMENTAL_INFO): align sizeof (GTypeFundamentalInfo)
        to size of longs and pointers.

17 files changed:
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
glib/gmem.c
glib/gscanner.c
gmem.c
gobject/ChangeLog
gobject/gparamspecs.c
gobject/gparamspecs.h
gobject/gsignal.h
gobject/gtype.c
gscanner.c

index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index ebcd9d189c33d112b1e74fdedd89e5a79005fea0..d4f5b0b203960d8b3190beda3c02dcbecfadeb31 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org>
+
+       * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm
+       to generate hashes.
+
+       * gmem.c (standard_calloc): free() doesn't return a value
+       (Mark Murnane).
+
 2001-04-26  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Get rid of --enable-msg-prefix
index a7d7153418349a2508b782889d66d1d75f917fae..805f6bdb0e53c017190ef459b79e3bbf83401b4d 100644 (file)
@@ -101,7 +101,7 @@ standard_realloc (gpointer mem,
 static void
 standard_free (gpointer mem)
 {
-  return free (mem);
+  free (mem);
 }
 static gpointer
 standard_calloc (gsize n_blocks,
index f770dd5a101ccacc8316153a04389a7dba015d8b..e73034a7f06085f4c21d650b4f63a27e020bd9bf 100644 (file)
@@ -366,17 +366,7 @@ g_scanner_key_hash (gconstpointer v)
   
   h = key->scope_id;
   for (c = key->symbol; *c; c++)
-    {
-      guint g;
-      
-      h = (h << 4) + *c;
-      g = h & 0xf0000000;
-      if (g)
-       {
-         h = h ^ (g >> 24);
-         h = h ^ g;
-       }
-    }
+    h = (h << 5) - h + *c;
   
   return h;
 }
diff --git a/gmem.c b/gmem.c
index a7d7153418349a2508b782889d66d1d75f917fae..805f6bdb0e53c017190ef459b79e3bbf83401b4d 100644 (file)
--- a/gmem.c
+++ b/gmem.c
@@ -101,7 +101,7 @@ standard_realloc (gpointer mem,
 static void
 standard_free (gpointer mem)
 {
-  return free (mem);
+  free (mem);
 }
 static gpointer
 standard_calloc (gsize n_blocks,
index b6fa6096f1eb3885b231af385cf03cba500d8637..a2182674d5bd93e900fa3838570656671e79af64 100644 (file)
@@ -1,3 +1,15 @@
+Thu May 10 14:00:48 2001  Tim Janik  <timj@gtk.org>
+
+       * gparamspecs.[hc]: removed g_param_spec_stringc() in lack of
+       evidence of public need.
+
+       * gsignal.h: added g_signal_disconnect_by_func(),
+       g_signal_block_by_func() and g_signal_unblock_by_func() convenience
+       macros as per owen's request.
+
+       * gtype.c (SIZEOF_FUNDAMENTAL_INFO): align sizeof (GTypeFundamentalInfo)
+       to size of longs and pointers.
+
 2001-05-05  James Henstridge  <james@daa.com.au>
 
        * Makefile.am: glib-mkenums is not a compiled program, so shouldn't
index cc44728080cf923fcfb7b065db94e1f9f7ea7668..9b2f104618b922c6d2c048d27833d63909a20f8d 100644 (file)
@@ -1577,31 +1577,6 @@ g_param_spec_string (const gchar *name,
   return G_PARAM_SPEC (sspec);
 }
 
-GParamSpec*
-g_param_spec_stringc (const gchar *name,
-                     const gchar *nick,
-                     const gchar *blurb,
-                     const gchar *default_value,
-                     GParamFlags  flags)
-{
-  GParamSpecString *sspec = g_param_spec_internal (G_TYPE_PARAM_STRING,
-                                                  name,
-                                                  nick,
-                                                  blurb,
-                                                  flags);
-  g_free (sspec->default_value);
-  sspec->default_value = g_strdup (default_value);
-  g_free (sspec->cset_first);
-  sspec->cset_first = g_strdup (G_CSET_a_2_z "_" G_CSET_A_2_Z);
-  g_free (sspec->cset_nth);
-  sspec->cset_nth = g_strdup (G_CSET_a_2_z
-                             "_0123456789"
-                             /* G_CSET_LATINS G_CSET_LATINC */
-                             G_CSET_A_2_Z);
-  
-  return G_PARAM_SPEC (sspec);
-}
-
 GParamSpec*
 g_param_spec_param (const gchar *name,
                    const gchar *nick,
index 3829d6cdb8f2f9d23eb0fede999b02646d8bdeae..89679b9effe4eb66e2867ebe229df49bc13dd2e1 100644 (file)
@@ -305,11 +305,6 @@ GParamSpec*        g_param_spec_string      (const gchar    *name,
                                          const gchar    *blurb,
                                          const gchar    *default_value,
                                          GParamFlags     flags);
-GParamSpec*    g_param_spec_stringc     (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         const gchar    *default_value,
-                                         GParamFlags     flags);
 GParamSpec*    g_param_spec_param       (const gchar    *name,
                                          const gchar    *nick,
                                          const gchar    *blurb,
index 4da55fd81f2be2da0e73a4d39cddececb50a87aa..9c429b7761dcca3373dda6f617be63d5b9465422 100644 (file)
@@ -218,7 +218,16 @@ guint       g_signal_handlers_disconnect_matched (gpointer           instance,
 /* --- convenience --- */
 #define g_signal_connectc(instance, detailed_signal, c_handler, data, swapped) \
     g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (swapped), FALSE)
-
+#define        g_signal_disconnect_by_func(instance, func, data) \
+    g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, \
+                                         0, 0, NULL, (func), (data))
+#define        g_signal_block_by_func(instance, func, data) \
+    g_signal_handlers_block_matched ((instance), G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, \
+                                    0, 0, NULL, (func), (data))
+#define        g_signal_unblock_by_func(instance, func, data) \
+    g_signal_handlers_unblock_matched ((instance), G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, \
+                                      0, 0, NULL, (func), (data))
+     
 /*< private >*/
 void    g_signal_handlers_destroy            (gpointer           instance);
 void    _g_signals_destroy                   (GType              itype);
index f1d3dac0f261981fc32f78e84af5ad8445dd8a2c..590598c57164b7f4b2597c78fe0b16da5d21b9ab 100644 (file)
@@ -99,6 +99,9 @@ static GStaticRWLock            type_rw_lock = G_STATIC_RW_LOCK_INIT;
                                    G_TYPE_FLAG_DERIVABLE | \
                                    G_TYPE_FLAG_DEEP_DERIVABLE)
 #define        TYPE_FLAG_MASK             (G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT)
+#define        SIZEOF_FUNDAMENTAL_INFO    ((gssize) MAX (MAX (sizeof (GTypeFundamentalInfo), \
+                                                      sizeof (gpointer)), \
+                                                  sizeof (glong)))
 
 
 /* --- typedefs --- */
@@ -287,12 +290,12 @@ type_node_any_new_W (TypeNode             *pnode,
     static_type_nodes[ftype] = g_renew (TypeNode*, static_type_nodes[ftype], 1 << g_bit_storage (static_branch_seqnos[ftype] - 1));
   
   if (!pnode)
-    node_size += sizeof (GTypeFundamentalInfo);              /* fundamental type info */
+    node_size += SIZEOF_FUNDAMENTAL_INFO;            /* fundamental type info */
   node_size += SIZEOF_BASE_TYPE_NODE ();             /* TypeNode structure */
   node_size += (sizeof (GType) * (1 + n_supers + 1)); /* self + ancestors + 0 for ->supers[] */
   node = g_malloc0 (node_size);
   if (!pnode)                                        /* offset fundamental types */
-    node = G_STRUCT_MEMBER_P (node, sizeof (GTypeFundamentalInfo));
+    node = G_STRUCT_MEMBER_P (node, SIZEOF_FUNDAMENTAL_INFO);
   static_type_nodes[ftype][branch_last] = node;
   
   node->n_supers = n_supers;
@@ -362,7 +365,7 @@ type_node_fundamental_info_L (TypeNode *node)
   if (ftype != NODE_TYPE (node))
     node = lookup_type_node_L (ftype);
   
-  return node ? G_STRUCT_MEMBER_P (node, - (gssize) sizeof (GTypeFundamentalInfo)) : NULL;
+  return node ? G_STRUCT_MEMBER_P (node, - SIZEOF_FUNDAMENTAL_INFO) : NULL;
 }
 
 static TypeNode*
index f770dd5a101ccacc8316153a04389a7dba015d8b..e73034a7f06085f4c21d650b4f63a27e020bd9bf 100644 (file)
@@ -366,17 +366,7 @@ g_scanner_key_hash (gconstpointer v)
   
   h = key->scope_id;
   for (c = key->symbol; *c; c++)
-    {
-      guint g;
-      
-      h = (h << 4) + *c;
-      g = h & 0xf0000000;
-      if (g)
-       {
-         h = h ^ (g >> 24);
-         h = h ^ g;
-       }
-    }
+    h = (h << 5) - h + *c;
   
   return h;
 }