styleproperties: Speed up style_property_lookup()
Use the already existing bsearch version instead of iterating the array manually.
This commit is contained in:
@ -490,7 +490,6 @@ gtk_style_properties_lookup_property (const gchar *property_name,
|
|||||||
GtkStylePropertiesClass *klass;
|
GtkStylePropertiesClass *klass;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
GQuark quark;
|
GQuark quark;
|
||||||
gint i;
|
|
||||||
|
|
||||||
g_return_val_if_fail (property_name != NULL, FALSE);
|
g_return_val_if_fail (property_name != NULL, FALSE);
|
||||||
|
|
||||||
@ -503,23 +502,17 @@ gtk_style_properties_lookup_property (const gchar *property_name,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < properties->len; i++)
|
node = property_node_lookup (quark);
|
||||||
|
|
||||||
|
if (node)
|
||||||
{
|
{
|
||||||
node = &g_array_index (properties, PropertyNode, i);
|
if (pspec)
|
||||||
|
*pspec = node->pspec;
|
||||||
|
|
||||||
if (node->property_quark == quark)
|
if (parse_func)
|
||||||
{
|
*parse_func = node->parse_func;
|
||||||
if (pspec)
|
|
||||||
*pspec = node->pspec;
|
|
||||||
|
|
||||||
if (parse_func)
|
found = TRUE;
|
||||||
*parse_func = node->parse_func;
|
|
||||||
|
|
||||||
found = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (node->property_quark > quark)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_type_class_unref (klass);
|
g_type_class_unref (klass);
|
||||||
|
|||||||
Reference in New Issue
Block a user