Don't cache the empty string

Avoid unnecessary reference counting for uses of the empty string.
This commit is contained in:
Simon Arlott
2021-07-08 20:43:02 +01:00
parent 320df7e409
commit 4a5b5f3bf2

View File

@@ -84,7 +84,7 @@ qof_string_cache_destroy (void)
void
qof_string_cache_remove(const char * key)
{
if (key)
if (key && key[0] != 0)
{
GHashTable* cache = qof_get_string_cache();
gpointer value;
@@ -111,6 +111,11 @@ qof_string_cache_insert(const char * key)
{
if (key)
{
if (key[0] == 0)
{
return "";
}
GHashTable* cache = qof_get_string_cache();
gpointer value;
gpointer cache_key;