cssparser: Add gtk_css_parser_consume_string()

Well, just rename _gtk_css_parser_read_string() for the new semantics,
but this sounds cooler.
This commit is contained in:
Benjamin Otte 2019-04-04 23:37:38 +02:00
parent e7b9ecc99a
commit f0d2f99239
9 changed files with 17 additions and 12 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}