summaryrefslogtreecommitdiff
path: root/gtk/gtkcssparserprivate.h
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-01-19 18:32:00 +0100
committerTimm Bäder <mail@baedert.org>2019-01-29 05:03:26 +0100
commit7f4b7c48e87313dc1be4f4895e182a58e8c55af7 (patch)
treee78560005c4193af9df72bfc490e91d63d95d89a /gtk/gtkcssparserprivate.h
parentdf1f036a95c41a8aa867e92c8fb4d5b7e566223b (diff)
downloadgtk+-7f4b7c48e87313dc1be4f4895e182a58e8c55af7.tar.gz
cssparser: Make _gtk_css_parser_try a macro
We almost always pass a constant string to it, so use a macro and try to trick the compiler into evaluating the 2(!) strlen() calls at compile time.
Diffstat (limited to 'gtk/gtkcssparserprivate.h')
-rw-r--r--gtk/gtkcssparserprivate.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gtk/gtkcssparserprivate.h b/gtk/gtkcssparserprivate.h
index 5bc2ad691b..3fb30f9136 100644
--- a/gtk/gtkcssparserprivate.h
+++ b/gtk/gtkcssparserprivate.h
@@ -66,8 +66,10 @@ gboolean _gtk_css_parser_is_string (GtkCssParser *parser
* however is fine to call if you don’t know yet if the token is a foo or a bar,
* you can _try_bar() if try_foo() failed.
*/
-gboolean _gtk_css_parser_try (GtkCssParser *parser,
+#define _gtk_css_parser_try(p, s, skip) (gtk_css_parser_try_len (p, s, strlen(s), skip))
+gboolean gtk_css_parser_try_len (GtkCssParser *parser,
const char *string,
+ gsize string_len,
gboolean skip_whitespace);
char * _gtk_css_parser_try_ident (GtkCssParser *parser,
gboolean skip_whitespace);