diff options
author | Garrett Regier <garrettregier@gmail.com> | 2015-09-11 17:49:59 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-09-11 18:26:11 +0200 |
commit | 41b386cd6a84957dd9820083fa594090660c6a5d (patch) | |
tree | acaff7d5678360b58f5b3af546f7c4f2dc0c3a65 /gtk/gtkwidgetpath.c | |
parent | 44460cd7207692e73f4374865a34314800ec2856 (diff) | |
download | gtk+-41b386cd6a84957dd9820083fa594090660c6a5d.tar.gz |
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.
Diffstat (limited to 'gtk/gtkwidgetpath.c')
-rw-r--r-- | gtk/gtkwidgetpath.c | 19 |
1 files changed, 11 insertions, 8 deletions
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)); |