[gtk+] cssselector: Inline a function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] cssselector: Inline a function
- Date: Wed, 10 Dec 2014 03:04:38 +0000 (UTC)
commit 80a8b793e010bd4dff03c5de7dbc320c4801c0d1
Author: Benjamin Otte <otte redhat com>
Date: Thu Dec 4 03:42:50 2014 +0100
cssselector: Inline a function
gtk/gtkcssselector.c | 54 +++++++++++++++++++++++--------------------------
1 files changed, 25 insertions(+), 29 deletions(-)
---
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index dd4c84e..c5cdecd 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -1855,31 +1855,6 @@ parse_selector_pseudo_class (GtkCssParser *parser,
}
static GtkCssSelector *
-try_parse_name (GtkCssParser *parser,
- GtkCssSelector *selector)
-{
- char *name;
-
- name = _gtk_css_parser_try_ident (parser, FALSE);
- if (name)
- {
- if (_gtk_style_context_check_region_name (name))
- selector = gtk_css_selector_new (>K_CSS_SELECTOR_REGION,
- selector,
- g_intern_string (name));
- else
- selector = gtk_css_selector_new (>K_CSS_SELECTOR_NAME,
- selector,
- get_type_reference (name));
- g_free (name);
- }
- else if (_gtk_css_parser_try (parser, "*", FALSE))
- selector = gtk_css_selector_new (>K_CSS_SELECTOR_ANY, selector, NULL);
-
- return selector;
-}
-
-static GtkCssSelector *
parse_selector_negation (GtkCssParser *parser,
GtkCssSelector *selector)
{
@@ -1926,9 +1901,28 @@ static GtkCssSelector *
parse_simple_selector (GtkCssParser *parser,
GtkCssSelector *selector)
{
- guint size = gtk_css_selector_size (selector);
-
- selector = try_parse_name (parser, selector);
+ gboolean parsed_something = FALSE;
+ char *name;
+
+ name = _gtk_css_parser_try_ident (parser, FALSE);
+ if (name)
+ {
+ if (_gtk_style_context_check_region_name (name))
+ selector = gtk_css_selector_new (>K_CSS_SELECTOR_REGION,
+ selector,
+ g_intern_string (name));
+ else
+ selector = gtk_css_selector_new (>K_CSS_SELECTOR_NAME,
+ selector,
+ get_type_reference (name));
+ g_free (name);
+ parsed_something = TRUE;
+ }
+ else if (_gtk_css_parser_try (parser, "*", FALSE))
+ {
+ selector = gtk_css_selector_new (>K_CSS_SELECTOR_ANY, selector, NULL);
+ parsed_something = TRUE;
+ }
do {
if (_gtk_css_parser_try (parser, "#", FALSE))
@@ -1939,7 +1933,7 @@ parse_simple_selector (GtkCssParser *parser,
selector = parse_selector_negation (parser, selector);
else if (_gtk_css_parser_try (parser, ":", FALSE))
selector = parse_selector_pseudo_class (parser, selector, FALSE);
- else if (gtk_css_selector_size (selector) == size)
+ else if (!parsed_something)
{
_gtk_css_parser_error (parser, "Expected a valid selector");
if (selector)
@@ -1948,6 +1942,8 @@ parse_simple_selector (GtkCssParser *parser,
}
else
break;
+
+ parsed_something = TRUE;
}
while (selector && !_gtk_css_parser_is_eof (parser));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]