[augeas-devel] augeas: master - * src/regexp.c: clean up syntax options

David Lutterkort lutter at fedoraproject.org
Wed Feb 18 22:03:21 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=a2216aa3a76f3195ee0e69c71891ae81f8ce95ea
Commit:        a2216aa3a76f3195ee0e69c71891ae81f8ce95ea
Parent:        dbd30a260729509b55c246cdb6056db270980b9a
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Sat Feb 14 21:42:54 2009 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Tue Feb 17 10:04:01 2009 -0800

* src/regexp.c: clean up syntax options

---
 src/regexp.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/regexp.c b/src/regexp.c
index e49dcff..3d1890a 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -275,12 +275,25 @@ struct regexp *regexp_make_empty(struct info *info) {
 }
 
 int regexp_compile(struct regexp *r) {
+    /* See the GNU regex manual or regex.h in gnulib for
+     * an explanation of these flags. They are set so that the regex
+     * matcher interprets regular expressions the same way that libfa
+     * does
+     */
+    static const reg_syntax_t syntax =
+        RE_CONTEXT_INDEP_OPS|RE_CONTEXT_INVALID_OPS|RE_DOT_NOT_NULL
+        |RE_INTERVALS|RE_NO_BK_BRACES|RE_NO_BK_PARENS|RE_NO_BK_REFS
+        |RE_NO_BK_VBAR|RE_NO_EMPTY_RANGES
+        |RE_NO_POSIX_BACKTRACKING|RE_CONTEXT_INVALID_DUP|RE_NO_GNU_OPS;
+    reg_syntax_t old_syntax = re_syntax_options;
+    const char *c = NULL;
+
     if (r->re == NULL)
         CALLOC(r->re, 1);
 
-    re_syntax_options = RE_SYNTAX_POSIX_MINIMAL_EXTENDED & ~(RE_DOT_NEWLINE);
-    const char *c =
-        re_compile_pattern(r->pattern->str, strlen(r->pattern->str), r->re);
+    re_syntax_options = syntax;
+    c = re_compile_pattern(r->pattern->str, strlen(r->pattern->str), r->re);
+    re_syntax_options = old_syntax;
 
     if (c != NULL) {
         char *p = escape(r->pattern->str, -1);




More information about the augeas-devel mailing list