summaryrefslogtreecommitdiff
path: root/gtk/gtkiconthemeprivate.h
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2020-02-07 11:54:00 +0100
committerAlexander Larsson <alexl@redhat.com>2020-02-07 12:00:52 +0100
commitbdbafe63f96b9fc9713ff8edb094f49b2c31a713 (patch)
tree82e4caa211e72c65603019f10f3a567c06b234e1 /gtk/gtkiconthemeprivate.h
parent2be29f982d9681b563f71dfb16faa261fc3c10b5 (diff)
downloadgtk+-bdbafe63f96b9fc9713ff8edb094f49b2c31a713.tar.gz
icontheme: Optimize memory use and lookup speed by internalizing icon names
Instead of having the IconTheme have a hashtable that owns individual strings and then IconThemeDirSize have a similar hash (but with the strings owned by the other hash), we have a consecutive memory chunks where we store the icon names and then the hashtable has pointers into this. This means we can avoid a bunch of individual strdup()s in a way that is less fragmented and wastes less space. Additionally, since we do an initial lookup anyway we have the internalized icon name during lookup which means we can use g_direct_hash/equal instead of g_str_hash/equal making the lookup faster too.
Diffstat (limited to 'gtk/gtkiconthemeprivate.h')
-rw-r--r--gtk/gtkiconthemeprivate.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gtk/gtkiconthemeprivate.h b/gtk/gtkiconthemeprivate.h
index 4a508b3443..495662d1aa 100644
--- a/gtk/gtkiconthemeprivate.h
+++ b/gtk/gtkiconthemeprivate.h
@@ -21,6 +21,10 @@
#include <gtk/gtkicontheme.h>
#include <gtk/gtkcssstyleprivate.h>
+typedef struct _GtkStringSet GtkStringSet;
+const char *gtk_string_set_add (GtkStringSet *set,
+ const char *string);
+
#define IMAGE_MISSING_RESOURCE_PATH "/org/gtk/libgtk/icons/16x16/status/image-missing.png"
void gtk_icon_theme_lookup_symbolic_colors (GtkCssStyle *style,