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
This commit is contained in:
Philip Withnall 2010-09-20 17:56:30 +01:00
parent f1f7e771d7
commit 60def049d9

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