[glib/wip/pcre-update: 1/17] regex: Assert that our flags values are the same as PCRE's



commit b90c23bdaf52c28d1f1e3ec288a622220fd16f56
Author: Christian Persch <chpe gnome org>
Date:   Thu Jun 7 14:48:51 2012 +0200

    regex: Assert that our flags values are the same as PCRE's
    
    We rely on those flags having the same values as PCRE's (so we can pass
    them right through), so assert this at compile time.

 glib/gregex.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/glib/gregex.c b/glib/gregex.c
index b7f0060..7da6569 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -125,6 +125,30 @@
                             G_REGEX_MATCH_NEWLINE_CRLF  | \
                             G_REGEX_MATCH_NEWLINE_ANY)
 
+/* we rely on these flags having the same values */
+G_STATIC_ASSERT (G_REGEX_CASELESS        == PCRE_CASELESS);
+G_STATIC_ASSERT (G_REGEX_MULTILINE       == PCRE_MULTILINE);
+G_STATIC_ASSERT (G_REGEX_DOTALL          == PCRE_DOTALL);
+G_STATIC_ASSERT (G_REGEX_EXTENDED        == PCRE_EXTENDED);
+G_STATIC_ASSERT (G_REGEX_ANCHORED        == PCRE_ANCHORED);
+G_STATIC_ASSERT (G_REGEX_DOLLAR_ENDONLY  == PCRE_DOLLAR_ENDONLY);
+G_STATIC_ASSERT (G_REGEX_UNGREEDY        == PCRE_UNGREEDY);
+G_STATIC_ASSERT (G_REGEX_NO_AUTO_CAPTURE == PCRE_NO_AUTO_CAPTURE);
+G_STATIC_ASSERT (G_REGEX_DUPNAMES        == PCRE_DUPNAMES);
+G_STATIC_ASSERT (G_REGEX_NEWLINE_CR      == PCRE_NEWLINE_CR);
+G_STATIC_ASSERT (G_REGEX_NEWLINE_LF      == PCRE_NEWLINE_LF);
+G_STATIC_ASSERT (G_REGEX_NEWLINE_CRLF    == PCRE_NEWLINE_CRLF);
+
+G_STATIC_ASSERT (G_REGEX_MATCH_ANCHORED     == PCRE_ANCHORED);
+G_STATIC_ASSERT (G_REGEX_MATCH_NOTBOL       == PCRE_NOTBOL);
+G_STATIC_ASSERT (G_REGEX_MATCH_NOTEOL       == PCRE_NOTEOL);
+G_STATIC_ASSERT (G_REGEX_MATCH_NOTEMPTY     == PCRE_NOTEMPTY);
+G_STATIC_ASSERT (G_REGEX_MATCH_PARTIAL      == PCRE_PARTIAL);
+G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_CR   == PCRE_NEWLINE_CR);
+G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_LF   == PCRE_NEWLINE_LF);
+G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_CRLF == PCRE_NEWLINE_CRLF);
+G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_ANY  == PCRE_NEWLINE_ANY);
+
 /* if the string is in UTF-8 use g_utf8_ functions, else use
  * use just +/- 1. */
 #define NEXT_CHAR(re, s) (((re)->compile_opts & PCRE_UTF8) ? \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]