[gtk] cssparser: Add gtk_css_parser_consume_url()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] cssparser: Add gtk_css_parser_consume_url()
- Date: Fri, 12 Apr 2019 17:38:00 +0000 (UTC)
commit 607502ef437978088caed0309137244dbda7a1e8
Author: Benjamin Otte <otte redhat com>
Date: Tue Apr 9 02:29:27 2019 +0200
cssparser: Add gtk_css_parser_consume_url()
Another slight renaming and semantics change.
gtk/gtkcssimagerecolor.c | 7 ++-----
gtk/gtkcssimageurl.c | 2 +-
gtk/gtkcssparser.c | 2 +-
gtk/gtkcssparserprivate.h | 2 +-
gtk/gtkcssprovider.c | 11 ++++++++---
5 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c
index 3ac856f651..2027b4ecc5 100644
--- a/gtk/gtkcssimagerecolor.c
+++ b/gtk/gtkcssimagerecolor.c
@@ -245,12 +245,9 @@ gtk_css_image_recolor_parse_arg (GtkCssParser *parser,
switch (arg)
{
case 0:
- self->file = _gtk_css_parser_read_url (parser);
+ self->file = gtk_css_parser_consume_url (parser);
if (self->file == NULL)
- {
- _gtk_css_parser_error (parser, "Expected a url here");
- return 0;
- }
+ return 0;
return 1;
case 1:
diff --git a/gtk/gtkcssimageurl.c b/gtk/gtkcssimageurl.c
index b4db3740a4..e46dd0ac9b 100644
--- a/gtk/gtkcssimageurl.c
+++ b/gtk/gtkcssimageurl.c
@@ -165,7 +165,7 @@ gtk_css_image_url_parse (GtkCssImage *image,
{
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
- url->file = _gtk_css_parser_read_url (parser);
+ url->file = gtk_css_parser_consume_url (parser);
if (url->file == NULL)
return FALSE;
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c
index fa613464a4..502f2ec794 100644
--- a/gtk/gtkcssparser.c
+++ b/gtk/gtkcssparser.c
@@ -1036,7 +1036,7 @@ _gtk_css_parser_try_hash_color (GtkCssParser *parser,
}
GFile *
-_gtk_css_parser_read_url (GtkCssParser *parser)
+gtk_css_parser_consume_url (GtkCssParser *parser)
{
gchar *path;
GFile *file;
diff --git a/gtk/gtkcssparserprivate.h b/gtk/gtkcssparserprivate.h
index 9dd518d531..fec25fceff 100644
--- a/gtk/gtkcssparserprivate.h
+++ b/gtk/gtkcssparserprivate.h
@@ -98,6 +98,7 @@ gboolean _gtk_css_parser_try_hash_color (GtkCssParser *parser
char * gtk_css_parser_consume_ident (GtkCssParser *self);
char * gtk_css_parser_consume_string (GtkCssParser *self);
+GFile * gtk_css_parser_consume_url (GtkCssParser *self);
gboolean gtk_css_parser_consume_number (GtkCssParser *self,
double *number);
gboolean gtk_css_parser_consume_integer (GtkCssParser *parser,
@@ -113,7 +114,6 @@ gsize gtk_css_parser_consume_any (GtkCssParser *parser
gpointer user_data);
gboolean _gtk_css_parser_has_number (GtkCssParser *parser);
-GFile * _gtk_css_parser_read_url (GtkCssParser *parser);
void _gtk_css_parser_skip_whitespace (GtkCssParser *parser);
void _gtk_css_parser_resync (GtkCssParser *parser,
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index bb77fcdbaa..1abcaa8472 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -787,12 +787,17 @@ parse_import (GtkCssScanner *scanner)
char *url;
url = gtk_css_parser_consume_string (scanner->parser);
- file = gtk_css_parser_resolve_url (scanner->parser, url);
- g_free (url);
+ if (url)
+ {
+ file = gtk_css_parser_resolve_url (scanner->parser, url);
+ g_free (url);
+ }
+ else
+ file = NULL;
}
else
{
- file = _gtk_css_parser_read_url (scanner->parser);
+ file = gtk_css_parser_consume_url (scanner->parser);
}
if (file == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]