[gtk/wip/otte/css: 22/35] parser: Get rid of _gtk_css_parser_is_eof()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/css: 22/35] parser: Get rid of _gtk_css_parser_is_eof()
- Date: Tue, 9 Apr 2019 04:04:39 +0000 (UTC)
commit 12b1c966a50c42561dde4fd43a1b9783ae1e0085
Author: Benjamin Otte <otte redhat com>
Date: Sun Mar 31 23:22:18 2019 +0200
parser: Get rid of _gtk_css_parser_is_eof()
Use gtk_css_parser_has_token() instead.
gtk/gtkcsskeyframes.c | 2 +-
gtk/gtkcssparser.c | 8 --------
gtk/gtkcssparserprivate.h | 1 -
gtk/gtkcssprovider.c | 12 ++++++------
gtk/gtkcssselector.c | 4 ++--
gtk/gtkcssshadowvalue.c | 2 +-
gtk/gtkcssshorthandpropertyimpl.c | 2 +-
gtk/gtkcssstylepropertyimpl.c | 2 +-
8 files changed, 12 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkcsskeyframes.c b/gtk/gtkcsskeyframes.c
index de43bc6ab0..12344965a4 100644
--- a/gtk/gtkcsskeyframes.c
+++ b/gtk/gtkcsskeyframes.c
@@ -312,7 +312,7 @@ parse_block (GtkCssKeyframes *keyframes,
if (!parse_declaration (keyframes, k, parser))
_gtk_css_parser_resync (parser, TRUE, '}');
- if (_gtk_css_parser_is_eof (parser))
+ if (gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF))
{
_gtk_css_parser_error (parser, "Expected closing '}' after keyframes block");
return FALSE;
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c
index cd9970bbf0..66f0ad8ef2 100644
--- a/gtk/gtkcssparser.c
+++ b/gtk/gtkcssparser.c
@@ -90,14 +90,6 @@ _gtk_css_parser_free (GtkCssParser *parser)
g_slice_free (GtkCssParser, parser);
}
-gboolean
-_gtk_css_parser_is_eof (GtkCssParser *parser)
-{
- g_return_val_if_fail (GTK_IS_CSS_PARSER (parser), TRUE);
-
- return *parser->data == 0;
-}
-
gboolean
_gtk_css_parser_has_prefix (GtkCssParser *parser,
const char *prefix)
diff --git a/gtk/gtkcssparserprivate.h b/gtk/gtkcssparserprivate.h
index 683246a6f8..001d2060e5 100644
--- a/gtk/gtkcssparserprivate.h
+++ b/gtk/gtkcssparserprivate.h
@@ -62,7 +62,6 @@ GFile * _gtk_css_parser_get_file (GtkCssParser *parser
GFile * _gtk_css_parser_get_file_for_path (GtkCssParser *parser,
const char *path);
-gboolean _gtk_css_parser_is_eof (GtkCssParser *parser);
gboolean _gtk_css_parser_has_prefix (GtkCssParser *parser,
const char *prefix);
gboolean gtk_css_parser_has_token (GtkCssParser *parser,
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 1e1f987692..3658b18d1e 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -948,7 +948,7 @@ parse_keyframes (GtkCssScanner *scanner)
GTK_CSS_PARSER_ERROR,
GTK_CSS_PARSER_ERROR_SYNTAX,
"expected '}' after declarations");
- if (!_gtk_css_parser_is_eof (scanner->parser))
+ if (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
_gtk_css_parser_resync (scanner->parser, FALSE, 0);
}
@@ -1051,7 +1051,7 @@ parse_declaration (GtkCssScanner *scanner,
if (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_SEMICOLON) &&
!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_CLOSE_CURLY) &&
- !_gtk_css_parser_is_eof (scanner->parser))
+ !gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
{
gtk_css_provider_error (scanner->provider,
scanner,
@@ -1101,7 +1101,7 @@ check_for_semicolon:
if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
{
if (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_CLOSE_CURLY) &&
- !_gtk_css_parser_is_eof (scanner->parser))
+ !gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
{
gtk_css_provider_error_literal (scanner->provider,
scanner,
@@ -1117,7 +1117,7 @@ static void
parse_declarations (GtkCssScanner *scanner,
GtkCssRuleset *ruleset)
{
- while (!_gtk_css_parser_is_eof (scanner->parser) &&
+ while (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF) &&
!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_CLOSE_CURLY))
{
parse_declaration (scanner, ruleset);
@@ -1161,7 +1161,7 @@ parse_ruleset (GtkCssScanner *scanner)
GTK_CSS_PARSER_ERROR,
GTK_CSS_PARSER_ERROR_SYNTAX,
"expected '}' after declarations");
- if (!_gtk_css_parser_is_eof (scanner->parser))
+ if (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
{
_gtk_css_parser_resync (scanner->parser, FALSE, 0);
g_slist_free_full (selectors, (GDestroyNotify) _gtk_css_selector_free);
@@ -1191,7 +1191,7 @@ parse_stylesheet (GtkCssScanner *scanner)
_gtk_css_parser_skip_whitespace (scanner->parser);
- while (!_gtk_css_parser_is_eof (scanner->parser))
+ while (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
{
if (_gtk_css_parser_try (scanner->parser, "<!--", TRUE) ||
_gtk_css_parser_try (scanner->parser, "-->", TRUE))
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index 1e207221c5..e653e69b98 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -1250,7 +1250,7 @@ parse_simple_selector (GtkCssParser *parser,
parsed_something = TRUE;
}
- while (selector && !_gtk_css_parser_is_eof (parser));
+ while (selector && !gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF));
_gtk_css_parser_skip_whitespace (parser);
@@ -1263,7 +1263,7 @@ _gtk_css_selector_parse (GtkCssParser *parser)
GtkCssSelector *selector = NULL;
while ((selector = parse_simple_selector (parser, selector)) &&
- !_gtk_css_parser_is_eof (parser) &&
+ !gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF) &&
!gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_COMMA) &&
!gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_OPEN_CURLY))
{
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index e87d753e1c..bd8746ab13 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -204,7 +204,7 @@ _gtk_css_shadow_value_new_for_transition (GtkCssValue *target)
static gboolean
value_is_done_parsing (GtkCssParser *parser)
{
- return _gtk_css_parser_is_eof (parser) ||
+ return gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_COMMA) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_SEMICOLON) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_CLOSE_CURLY);
diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c
index a436c92c5b..367c81f575 100644
--- a/gtk/gtkcssshorthandpropertyimpl.c
+++ b/gtk/gtkcssshorthandpropertyimpl.c
@@ -50,7 +50,7 @@
static gboolean
value_is_done_parsing (GtkCssParser *parser)
{
- return _gtk_css_parser_is_eof (parser) ||
+ return gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_COMMA) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_SEMICOLON) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_CLOSE_CURLY);
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 70f5c4bbfb..27971095fa 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -479,7 +479,7 @@ parse_font_kerning (GtkCssStyleProperty *property,
static gboolean
value_is_done_parsing (GtkCssParser *parser)
{
- return _gtk_css_parser_is_eof (parser) ||
+ return gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_COMMA) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_SEMICOLON) ||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_CLOSE_CURLY);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]