[gtk] cssparser: Add gtk_css_parser_consume_string()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] cssparser: Add gtk_css_parser_consume_string()
- Date: Fri, 12 Apr 2019 17:37:35 +0000 (UTC)
commit f0d2f99239100caebc7c74b76e9cc819935d14ba
Author: Benjamin Otte <otte redhat com>
Date: Thu Apr 4 23:37:38 2019 +0200
cssparser: Add gtk_css_parser_consume_string()
Well, just rename _gtk_css_parser_read_string() for the new semantics,
but this sounds cooler.
gtk/gtkcssfontfeaturesvalue.c | 2 +-
gtk/gtkcssfontvariationsvalue.c | 2 +-
gtk/gtkcssiconthemevalue.c | 2 +-
gtk/gtkcssimageicontheme.c | 2 +-
gtk/gtkcssparser.c | 6 +++---
gtk/gtkcssparserprivate.h | 2 +-
gtk/gtkcssprovider.c | 2 +-
gtk/gtkcssstringvalue.c | 9 +++++++--
gtk/gtkcssstylepropertyimpl.c | 2 +-
9 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkcssfontfeaturesvalue.c b/gtk/gtkcssfontfeaturesvalue.c
index d116157229..a64ee3fce5 100644
--- a/gtk/gtkcssfontfeaturesvalue.c
+++ b/gtk/gtkcssfontfeaturesvalue.c
@@ -237,7 +237,7 @@ gtk_css_font_features_value_parse (GtkCssParser *parser)
do {
_gtk_css_parser_skip_whitespace (parser);
- name = _gtk_css_parser_read_string (parser);
+ name = gtk_css_parser_consume_string (parser);
if (name == NULL)
{
_gtk_css_value_unref (result);
diff --git a/gtk/gtkcssfontvariationsvalue.c b/gtk/gtkcssfontvariationsvalue.c
index c8d0ab02a0..be3ab90e72 100644
--- a/gtk/gtkcssfontvariationsvalue.c
+++ b/gtk/gtkcssfontvariationsvalue.c
@@ -235,7 +235,7 @@ gtk_css_font_variations_value_parse (GtkCssParser *parser)
do {
_gtk_css_parser_skip_whitespace (parser);
- name = _gtk_css_parser_read_string (parser);
+ name = gtk_css_parser_consume_string (parser);
if (name == NULL)
{
_gtk_css_value_unref (result);
diff --git a/gtk/gtkcssiconthemevalue.c b/gtk/gtkcssiconthemevalue.c
index 82e70775d0..8d98e4b50d 100644
--- a/gtk/gtkcssiconthemevalue.c
+++ b/gtk/gtkcssiconthemevalue.c
@@ -150,7 +150,7 @@ gtk_css_icon_theme_value_parse (GtkCssParser *parser)
GtkCssValue *result;
char *s;
- s = _gtk_css_parser_read_string (parser);
+ s = gtk_css_parser_consume_string (parser);
if (s == NULL)
return NULL;
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index ee0dee9afe..3cea6ee0b2 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -133,7 +133,7 @@ gtk_css_image_icon_theme_parse_arg (GtkCssParser *parser,
{
GtkCssImageIconTheme *icon_theme = data;
- icon_theme->name = _gtk_css_parser_read_string (parser);
+ icon_theme->name = gtk_css_parser_consume_string (parser);
if (icon_theme->name == NULL)
return 0;
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c
index 774b1dbdfa..49ba8fe1dc 100644
--- a/gtk/gtkcssparser.c
+++ b/gtk/gtkcssparser.c
@@ -678,7 +678,7 @@ gtk_css_parser_has_function (GtkCssParser *parser,
}
char *
-_gtk_css_parser_read_string (GtkCssParser *parser)
+gtk_css_parser_consume_string (GtkCssParser *parser)
{
GString *str;
char quote;
@@ -1019,7 +1019,7 @@ _gtk_css_parser_read_url (GtkCssParser *parser)
return NULL;
}
- path = _gtk_css_parser_read_string (parser);
+ path = gtk_css_parser_consume_string (parser);
if (path == NULL)
return NULL;
@@ -1073,7 +1073,7 @@ gtk_css_parser_resync_internal (GtkCssParser *parser,
if (gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_STRING))
{
/* Hrm, this emits errors, and i suspect it shouldn't... */
- char *free_me = _gtk_css_parser_read_string (parser);
+ char *free_me = gtk_css_parser_consume_string (parser);
g_free (free_me);
continue;
}
diff --git a/gtk/gtkcssparserprivate.h b/gtk/gtkcssparserprivate.h
index 1a77c58cd3..82474ff378 100644
--- a/gtk/gtkcssparserprivate.h
+++ b/gtk/gtkcssparserprivate.h
@@ -98,6 +98,7 @@ gboolean _gtk_css_parser_try_hash_color (GtkCssParser *parser
GdkRGBA *rgba);
char * gtk_css_parser_consume_ident (GtkCssParser *self);
+char * gtk_css_parser_consume_string (GtkCssParser *self);
gboolean gtk_css_parser_consume_number (GtkCssParser *self,
double *number);
gboolean gtk_css_parser_consume_function (GtkCssParser *self,
@@ -111,7 +112,6 @@ gsize gtk_css_parser_consume_any (GtkCssParser *parser
gpointer user_data);
gboolean _gtk_css_parser_has_number (GtkCssParser *parser);
-char * _gtk_css_parser_read_string (GtkCssParser *parser);
GFile * _gtk_css_parser_read_url (GtkCssParser *parser);
void _gtk_css_parser_skip_whitespace (GtkCssParser *parser);
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index f7a611d369..e119e61a30 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -786,7 +786,7 @@ parse_import (GtkCssScanner *scanner)
{
char *uri;
- uri = _gtk_css_parser_read_string (scanner->parser);
+ uri = gtk_css_parser_consume_string (scanner->parser);
file = _gtk_css_parser_get_file_for_path (scanner->parser, uri);
g_free (uri);
}
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index f6d0c2bf15..0cd7249698 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -160,7 +160,7 @@ _gtk_css_string_value_parse (GtkCssParser *parser)
g_return_val_if_fail (parser != NULL, NULL);
- s = _gtk_css_parser_read_string (parser);
+ s = gtk_css_parser_consume_string (parser);
if (s == NULL)
return NULL;
@@ -200,9 +200,14 @@ _gtk_css_ident_value_try_parse (GtkCssParser *parser)
g_return_val_if_fail (parser != NULL, NULL);
+ if (!gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_IDENT))
+ return NULL;
+
ident = gtk_css_parser_consume_ident (parser);
if (ident == NULL)
- return NULL;
+ {
+ g_assert_not_reached ();
+ }
return _gtk_css_ident_value_new_take (ident);
}
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 77a3d5f719..ec0c97cf61 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -177,7 +177,7 @@ font_family_parse_one (GtkCssParser *parser)
}
else
{
- name = _gtk_css_parser_read_string (parser);
+ name = gtk_css_parser_consume_string (parser);
if (name == NULL)
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]