mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 09:40:19 +00:00
styleproperties: Use the pspec as the hash table key
The code used the quarked name before, but when we already have the pspec we want to have a lookup that does not involve quarking. And lookup is equally fast if we only have the name.
This commit is contained in:
parent
d6f0042773
commit
beba515243
@ -708,15 +708,12 @@ gtk_style_properties_set_property (GtkStyleProperties *props,
|
|||||||
g_return_if_fail (node->pspec->value_type == value_type);
|
g_return_if_fail (node->pspec->value_type == value_type);
|
||||||
|
|
||||||
priv = props->priv;
|
priv = props->priv;
|
||||||
prop = g_hash_table_lookup (priv->properties,
|
prop = g_hash_table_lookup (priv->properties, node->pspec);
|
||||||
GINT_TO_POINTER (node->property_quark));
|
|
||||||
|
|
||||||
if (!prop)
|
if (!prop)
|
||||||
{
|
{
|
||||||
prop = property_data_new ();
|
prop = property_data_new ();
|
||||||
g_hash_table_insert (priv->properties,
|
g_hash_table_insert (priv->properties, node->pspec, prop);
|
||||||
GINT_TO_POINTER (node->property_quark),
|
|
||||||
prop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val = property_data_get_value (prop, state);
|
val = property_data_get_value (prop, state);
|
||||||
@ -772,15 +769,12 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = g_hash_table_lookup (priv->properties,
|
prop = g_hash_table_lookup (priv->properties, node->pspec);
|
||||||
GINT_TO_POINTER (node->property_quark));
|
|
||||||
|
|
||||||
if (!prop)
|
if (!prop)
|
||||||
{
|
{
|
||||||
prop = property_data_new ();
|
prop = property_data_new ();
|
||||||
g_hash_table_insert (priv->properties,
|
g_hash_table_insert (priv->properties, node->pspec, prop);
|
||||||
GINT_TO_POINTER (node->property_quark),
|
|
||||||
prop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val = property_data_get_value (prop, state);
|
val = property_data_get_value (prop, state);
|
||||||
@ -957,8 +951,7 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv = props->priv;
|
priv = props->priv;
|
||||||
prop = g_hash_table_lookup (priv->properties,
|
prop = g_hash_table_lookup (priv->properties, node->pspec);
|
||||||
GINT_TO_POINTER (node->property_quark));
|
|
||||||
|
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1010,8 +1003,7 @@ gtk_style_properties_get_property (GtkStyleProperties *props,
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv = props->priv;
|
priv = props->priv;
|
||||||
prop = g_hash_table_lookup (priv->properties,
|
prop = g_hash_table_lookup (priv->properties, node->pspec);
|
||||||
GINT_TO_POINTER (node->property_quark));
|
|
||||||
|
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1072,8 +1064,7 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = g_hash_table_lookup (priv->properties,
|
prop = g_hash_table_lookup (priv->properties, node->pspec);
|
||||||
GINT_TO_POINTER (node->property_quark));
|
|
||||||
|
|
||||||
if (prop)
|
if (prop)
|
||||||
val = property_data_match_state (prop, state);
|
val = property_data_match_state (prop, state);
|
||||||
@ -1165,8 +1156,7 @@ gtk_style_properties_unset_property (GtkStyleProperties *props,
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv = props->priv;
|
priv = props->priv;
|
||||||
prop = g_hash_table_lookup (priv->properties,
|
prop = g_hash_table_lookup (priv->properties, node->pspec);
|
||||||
GINT_TO_POINTER (node->property_quark));
|
|
||||||
|
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user