From 41b386cd6a84957dd9820083fa594090660c6a5d Mon Sep 17 00:00:00 2001 From: Garrett Regier Date: Fri, 11 Sep 2015 17:49:59 +0200 Subject: cssnode: Optimize listing of classes Avoid creating the GList of strings when the GQuarks will just be determined again. Instead have gtk_style_context_list_classes() do it specifically. --- gtk/gtkwidgetpath.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gtk/gtkwidgetpath.c') diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c index e8a7ac7919..f83af297a1 100644 --- a/gtk/gtkwidgetpath.c +++ b/gtk/gtkwidgetpath.c @@ -805,20 +805,23 @@ gtk_widget_path_iter_add_class (GtkWidgetPath *path, gint pos, const gchar *name) { - GtkPathElement *elem; - gboolean added = FALSE; - GQuark qname; - guint i; - gtk_internal_return_if_fail (path != NULL); gtk_internal_return_if_fail (path->elems->len != 0); gtk_internal_return_if_fail (name != NULL); - if (pos < 0 || pos >= path->elems->len) - pos = path->elems->len - 1; + gtk_widget_path_iter_add_qclass (path, pos, g_quark_from_string (name)); +} + +void +gtk_widget_path_iter_add_qclass (GtkWidgetPath *path, + gint pos, + GQuark qname) +{ + GtkPathElement *elem; + gboolean added = FALSE; + guint i; elem = &g_array_index (path->elems, GtkPathElement, pos); - qname = g_quark_from_string (name); if (!elem->classes) elem->classes = g_array_new (FALSE, FALSE, sizeof (GQuark)); -- cgit v1.2.1