From 4a5b5f3bf2e7616c2da600ecf25bb470e5710c0c Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Thu, 8 Jul 2021 20:43:02 +0100 Subject: [PATCH] Don't cache the empty string Avoid unnecessary reference counting for uses of the empty string. --- libgnucash/engine/qof-string-cache.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libgnucash/engine/qof-string-cache.cpp b/libgnucash/engine/qof-string-cache.cpp index 68e4fe479c..eb236ebd0e 100644 --- a/libgnucash/engine/qof-string-cache.cpp +++ b/libgnucash/engine/qof-string-cache.cpp @@ -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;