[glib/glib-2-26] Bug 630185 — Allow NULL strings in g_quark_try_string()



commit 2cbc1ca7230354ad6ce2dbc83b15ff01ff3b6037
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Sep 20 17:56:30 2010 +0100

    Bug 630185 â?? Allow NULL strings in g_quark_try_string()
    
    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 |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/glib/gdataset.c b/glib/gdataset.c
index 9a3e8f9..cd3a51e 100644
--- a/glib/gdataset.c
+++ b/glib/gdataset.c
@@ -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));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]