[glib/wip/pcre-update: 6/8] regex: Add new error code alias



commit cbf736b64c440e303d5e14b564d506e4cd96ab67
Author: Christian Persch <chpe gnome org>
Date:   Sat Nov 22 21:54:17 2014 +0100

    regex: Add new error code alias
    
    G_REGEX_ERROR_VERB_UNKNOWN_OR_MALFORMED has the same value as
    G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB but is more correct,
    since the same error code is now also used when the argument for
    "(*VERB=arg)" is malformed. Since PCRE 8.33.

 glib/gregex.c      |    2 +-
 glib/gregex.h      |    3 +++
 glib/tests/regex.c |    1 +
 3 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/glib/gregex.c b/glib/gregex.c
index ad75bd8..1f8ebe8 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -482,7 +482,7 @@ translate_compile_error (gint *errcode, const gchar **errmsg)
       *errmsg = _("an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)");
       break;
     case G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB:
-      *errmsg = _("(*VERB) not recognized");
+      *errmsg = _("(*VERB) not recognized or malformed");
       break;
     case G_REGEX_ERROR_NUMBER_TOO_BIG:
       *errmsg = _("number is too big");
diff --git a/glib/gregex.h b/glib/gregex.h
index b22fcf5..28d4dd9 100644
--- a/glib/gregex.h
+++ b/glib/gregex.h
@@ -136,6 +136,8 @@ G_BEGIN_DECLS
  * @G_REGEX_ERROR_RAW_LOCK: switching to UTF-8 mode from the pattern is disallowed.
  *     This happens when using %G_REGEX_RAW_LOCK and the pattern contains "(*UTF)"
  *     or "(*UTF8)". Since: 2.44
+ * @G_REGEX_ERROR_VERB_UNKNOWN_OR_MALFORMED: unknown or malformed backtracing 
+ *     control verb. Same as %G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB. Since: 2.44
  *
  * Error codes returned by regular expressions functions.
  *
@@ -190,6 +192,7 @@ typedef enum
   G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE = 158,
   G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN = 159,
   G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB  = 160,
+  G_REGEX_ERROR_VERB_UNKNOWN_OR_MALFORMED = G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB,
   G_REGEX_ERROR_NUMBER_TOO_BIG = 161,
   G_REGEX_ERROR_MISSING_SUBPATTERN_NAME = 162,
   G_REGEX_ERROR_MISSING_DIGIT = 163,
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index b3f2ecd..b9380e7 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -2280,6 +2280,7 @@ main (int argc, char *argv[])
   TEST_NEW_FAIL 
("(*:0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEFG)XX",
 0, G_REGEX_ERROR_NAME_TOO_LONG);
   TEST_NEW_FAIL ("\\u0100", G_REGEX_RAW | G_REGEX_JAVASCRIPT_COMPAT, 
G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE);
   TEST_NEW_FAIL ("(*UTF)", G_REGEX_RAW | G_REGEX_RAW_LOCK, G_REGEX_ERROR_RAW_LOCK);
+  TEST_NEW_FAIL ("(*LIMIT_MATCH=abc)", 0, G_REGEX_ERROR_VERB_UNKNOWN_OR_MALFORMED);
 
   /* These errors can't really be tested sanely:
    * G_REGEX_ERROR_EXPRESSION_TOO_LARGE


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