Accept NULL and return GQuark value of zero. (#446859)

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
This commit is contained in:
Behdad Esfahbod 2007-06-17 07:43:34 +00:00 committed by Behdad Esfahbod
parent fe20105fb4
commit f50d64c6ad
4 changed files with 22 additions and 9 deletions

View File

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

View 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

View 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 ##### -->

View 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);