Bug 630185 — Allow NULL strings in g_quark_try_string()
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 20 Sep 2010 16:56:30 +0000 (17:56 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 21 Sep 2010 09:35:36 +0000 (10:35 +0100)
Allow NULL strings to be passed to g_quark_try_string(), returning a 0 quark
in that case, as per the existing documentation. Closes: bgo#630185

glib/gdataset.c

index 9a3e8f9..cd3a51e 100644 (file)
@@ -1000,8 +1000,10 @@ GQuark
 g_quark_try_string (const gchar *string)
 {
   GQuark quark = 0;
-  g_return_val_if_fail (string != NULL, 0);
-  
+
+  if (string == NULL)
+    return 0;
+
   G_LOCK (g_quark_global);
   if (g_quark_ht)
     quark = GPOINTER_TO_UINT (g_hash_table_lookup (g_quark_ht, string));