[Gnucash-changes] r14280 - gnucash/branches/register-rewrite/lib/libqof/qof - Get a valid string from CACHE_INSERT(), even when we insert NULL.

Chris Shoemaker chris at cvs.gnucash.org
Wed May 31 00:07:32 EDT 2006


Author: chris
Date: 2006-05-31 00:07:31 -0400 (Wed, 31 May 2006)
New Revision: 14280
Trac: http://svn.gnucash.org/trac/changeset/14280

Modified:
   gnucash/branches/register-rewrite/lib/libqof/qof/qofutil.c
Log:
   Get a valid string from CACHE_INSERT(), even when we insert NULL.
   This will let us dereference the result without checking it, like would
   be done in a hashtable key function.


Modified: gnucash/branches/register-rewrite/lib/libqof/qof/qofutil.c
===================================================================
--- gnucash/branches/register-rewrite/lib/libqof/qof/qofutil.c	2006-05-31 02:04:28 UTC (rev 14279)
+++ gnucash/branches/register-rewrite/lib/libqof/qof/qofutil.c	2006-05-31 04:07:31 UTC (rev 14280)
@@ -391,9 +391,9 @@
 gpointer
 qof_util_string_cache_insert(gconstpointer key)
 {
-    if (key)
-        return g_cache_insert(qof_util_get_string_cache(), (gpointer)key);
-    return NULL;
+    static gchar* blank = "";
+    return g_cache_insert(qof_util_get_string_cache(), 
+                          (gpointer) (key ? key : blank));
 }
 
 gchar*



More information about the gnucash-changes mailing list