[augeas-devel] [PATCH 4 of 4] Eliminate unneeded calls to regexp_match in split_iter

David Lutterkort dlutter at redhat.com
Fri Aug 8 22:46:26 UTC 2008


2 files changed, 2 insertions(+), 15 deletions(-)
src/get.c |    8 +-------
src/put.c |    9 +--------


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1218235566 25200
# Node ID 53884175f2e4662e699197dd49fd2cdc46f69873
# Parent  5dfbe6d1739f5478286ef99ea16315a9a6816c3b
Eliminate unneeded calls to regexp_match in split_iter

diff -r 5dfbe6d1739f -r 53884175f2e4 src/get.c
--- a/src/get.c	Fri Aug 08 15:45:37 2008 -0700
+++ b/src/get.c	Fri Aug 08 15:46:06 2008 -0700
@@ -349,15 +349,9 @@
     struct split *split = NULL;
     struct regexp *ctype = lens->child->ctype;
 
+    MEMZERO(&regs, 1);
     if (ctype->re != NULL)
         ctype->re->regs_allocated = REGS_UNALLOCATED;
-    count = regexp_match(ctype, outer->start, outer->size, 0, &regs);
-    if (count == -2) {
-        FIXME("Match failed - produce better error");
-        abort();
-    } else if (count == -1) {
-        return NULL;
-    }
 
     const int reg = 0;
     int pos = 0;
diff -r 5dfbe6d1739f -r 53884175f2e4 src/put.c
--- a/src/put.c	Fri Aug 08 15:45:37 2008 -0700
+++ b/src/put.c	Fri Aug 08 15:46:06 2008 -0700
@@ -233,16 +233,9 @@
     struct split *split = NULL;
     struct regexp *atype = lens->child->atype;
 
+    MEMZERO((&regs), 1);
     if (atype->re != NULL)
         atype->re->regs_allocated = REGS_UNALLOCATED;
-    count = regexp_match(atype, outer->labels, outer->end,
-                         outer->start, &regs);
-    if (count == -2) {
-        FIXME("Match failed - produce better error");
-        abort();
-    } else if (count == -1) {
-        return NULL;
-    }
 
     struct tree *cur = outer->tree;
     const int reg = 0;




More information about the augeas-devel mailing list