summaryrefslogtreecommitdiff
path: root/gtk/inspector
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2020-01-24 00:43:26 +0100
committerBenjamin Otte <otte@redhat.com>2020-01-28 02:17:03 +0100
commit146b9212462b8a8ba8eb5c162bc667fe5a792bb0 (patch)
treeb1b9088c9fe8a062da4d3f8b322987a5301e4c87 /gtk/inspector
parent8b93ea9238bcbb99f6caadca9f6ef1d422926a35 (diff)
downloadgtk+-146b9212462b8a8ba8eb5c162bc667fe5a792bb0.tar.gz
cssnode: Convert name + id from interned string to GQuark
The reason for this is simply that I want to get hash functions that have their values close together, so they can fit in a smaller range (the goal here is 12 bits). By using GQuark, we get consecutive numbers starting with 1 (and applications have <1000 quarks usually), whereas interned strings can be all over the place. As a side effect we also save 64 bytes per declaration.
Diffstat (limited to 'gtk/inspector')
-rw-r--r--gtk/inspector/css-node-tree.c4
-rw-r--r--gtk/inspector/prop-editor.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/gtk/inspector/css-node-tree.c b/gtk/inspector/css-node-tree.c
index 11741e7c79..c465f7a5a9 100644
--- a/gtk/inspector/css-node-tree.c
+++ b/gtk/inspector/css-node-tree.c
@@ -314,7 +314,7 @@ gtk_inspector_css_node_tree_get_node_value (GtkTreeModelCssNode *model,
switch (column)
{
case COLUMN_NODE_NAME:
- g_value_set_string (value, gtk_css_node_get_name (node));
+ g_value_set_string (value, g_quark_to_string (gtk_css_node_get_name (node)));
break;
case COLUMN_NODE_VISIBLE:
@@ -330,7 +330,7 @@ gtk_inspector_css_node_tree_get_node_value (GtkTreeModelCssNode *model,
break;
case COLUMN_NODE_ID:
- g_value_set_string (value, gtk_css_node_get_id (node));
+ g_value_set_string (value, g_quark_to_string (gtk_css_node_get_id (node)));
break;
case COLUMN_NODE_STATE:
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
index 6c7471b0e3..72dc14c2a8 100644
--- a/gtk/inspector/prop-editor.c
+++ b/gtk/inspector/prop-editor.c
@@ -351,11 +351,11 @@ intern_string_modified (GtkEntry *entry, ObjectProperty *p)
{
const gchar *s;
- s = g_intern_string (gtk_editable_get_text (GTK_EDITABLE (entry)));
+ s = gtk_editable_get_text (GTK_EDITABLE (entry));
if (g_str_equal (p->spec->name, "id"))
- gtk_css_node_set_id (GTK_CSS_NODE (p->obj), s);
+ gtk_css_node_set_id (GTK_CSS_NODE (p->obj), g_quark_from_string (s));
else if (g_str_equal (p->spec->name, "name"))
- gtk_css_node_set_name (GTK_CSS_NODE (p->obj), s);
+ gtk_css_node_set_name (GTK_CSS_NODE (p->obj), g_quark_from_string (s));
}
static void