Accept NULL and return GQuark value of zero. (#446859)
authorBehdad Esfahbod <behdad@gnome.org>
Sun, 17 Jun 2007 07:43:34 +0000 (07:43 +0000)
committerBehdad Esfahbod <behdad@src.gnome.org>
Sun, 17 Jun 2007 07:43:34 +0000 (07:43 +0000)
2007-06-17  Behdad Esfahbod  <behdad@gnome.org>

        * glib/gdataset.c (g_quark_from_string),
        (g_quark_from_static_string): Accept NULL and return GQuark
        value of zero. (#446859)

svn path=/trunk/; revision=5572

ChangeLog
docs/reference/ChangeLog
docs/reference/glib/tmpl/quarks.sgml
glib/gdataset.c

index 3a996de..4b3e1d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-06-17  Behdad Esfahbod  <behdad@gnome.org>
+
+       * glib/gdataset.c (g_quark_from_string),
+       (g_quark_from_static_string): Accept NULL and return GQuark
+       value of zero. (#446859)
+
 2007-06-16  Mathias Hasselmann  <mathias.hasselmann@gmx.de>
 
        * glib/gstring.c: Correctly use g_printf_string_upper_bound
index fc77b44..f0be2ad 100644 (file)
@@ -1,3 +1,7 @@
+2007-06-17  Behdad Esfahbod  <behdad@gnome.org>
+
+       * glib/tmpl/quarks.sgml:
+
 2007-06-16  Emmanuele Bassi  <ebassi@gnome.org>
 
        * glib/tmpl/macros.sgml: Document the undefined behaviour of
index 6803cde..c3b07d4 100644 (file)
@@ -43,7 +43,8 @@ using strcmp().
 
 <!-- ##### TYPEDEF GQuark ##### -->
 <para>
-A GQuark is an integer which uniquely identifies a particular string.
+A GQuark is a non-zero integer which uniquely identifies a particular string.
+A GQuark value of zero is associated to %NULL.
 </para>
 
 
@@ -55,7 +56,7 @@ If the string does not currently have an associated #GQuark, a new
 </para>
 
 @string: a string.
-@Returns: the #GQuark identifying the string.
+@Returns: the #GQuark identifying the string, or 0 if @string is %NULL.
 
 
 <!-- ##### FUNCTION g_quark_from_static_string ##### -->
@@ -76,7 +77,7 @@ GTK+ theme engines).
 </para>
 
 @string: a string.
-@Returns: the #GQuark identifying the string.
+@Returns: the #GQuark identifying the string, or 0 if @string is %NULL.
 
 
 <!-- ##### FUNCTION g_quark_to_string ##### -->
@@ -90,8 +91,8 @@ Gets the string associated with the given #GQuark.
 
 <!-- ##### FUNCTION g_quark_try_string ##### -->
 <para>
-Gets the #GQuark associated with the given string, or 0 if the string has
-no associated #GQuark.
+Gets the #GQuark associated with the given string, or 0 if string is
+%NULL or it has no associated #GQuark.
 </para>
 <para>
 If you want the GQuark to be created if it doesn't already exist, use
@@ -99,8 +100,8 @@ g_quark_from_string() or g_quark_from_static_string().
 </para>
 
 @string: a string.
-@Returns: the #GQuark associated with the string, or 0 if there is no
-#GQuark associated with the string.
+@Returns: the #GQuark associated with the string, or 0 if @string is
+%NULL or there is no #GQuark associated with it.
 
 
 <!-- ##### FUNCTION g_intern_string ##### -->
index cc2a5c7..fe6e4ed 100644 (file)
@@ -635,7 +635,8 @@ g_quark_from_string (const gchar *string)
 {
   GQuark quark;
   
-  g_return_val_if_fail (string != NULL, 0);
+  if (!string)
+    return 0;
   
   G_LOCK (g_quark_global);
   quark = g_quark_from_string_internal (string, TRUE);
@@ -649,7 +650,8 @@ g_quark_from_static_string (const gchar *string)
 {
   GQuark quark;
   
-  g_return_val_if_fail (string != NULL, 0);
+  if (!string)
+    return 0;
   
   G_LOCK (g_quark_global);
   quark = g_quark_from_string_internal (string, FALSE);