[augeas-devel] [PATCH] lns_key_regexp: store does not do anything about the key

David Lutterkort dlutter at redhat.com
Thu Jul 24 17:07:41 UTC 2008


1 file changed, 5 insertions(+), 18 deletions(-)
src/lens.c |   23 +++++------------------


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1216919254 25200
# Node ID a5ed9b8875570a8173adb14a5da73c077fb61ec5
# Parent  48510fd51525cc169125cc72a8cfb97fe6049dac
lns_key_regexp: store does not do anything about the key

We used to generate tree nodes with a NULL label for a STORE, but that is
no longer the case, and therefore the STORE lens should not produce any key
regexp.

diff -r 48510fd51525 -r a5ed9b887557 src/lens.c
--- a/src/lens.c	Thu Jul 24 09:54:01 2008 -0700
+++ b/src/lens.c	Thu Jul 24 10:07:34 2008 -0700
@@ -460,11 +460,6 @@
    label of the tree that STORE created.
  */
 static struct regexp *lns_key_regexp(struct lens *l, struct value **exn) {
-    static const struct string leaf_key_string = {
-        .ref = REF_MAX, .str = (char *) "/"
-    };
-    static const struct string *const leaf_key_pat = &leaf_key_string;
-
     static const struct string digits_string = {
         .ref = REF_MAX, .str = (char *) "[0-9]+/"
     };
@@ -473,7 +468,6 @@
     *exn = NULL;
     switch(l->tag) {
     case L_STORE:
-        return make_regexp_from_string(l->info, (struct string *) leaf_key_pat);
     case L_DEL:
     case L_COUNTER:
         return NULL;
@@ -504,18 +498,11 @@
                 }
                 if (r != NULL) {
                     if (k != NULL) {
-                        if (k->pattern == leaf_key_pat) {
-                            unref(k, regexp);
-                            k = r;
-                        } else if (r->pattern == leaf_key_pat) {
-                            unref(r, regexp);
-                        } else {
-                            *exn = make_exn_value(ref(l->info),
-                                                  "More than one key");
-                            unref(r, regexp);
-                            unref(k, regexp);
-                            return NULL;
-                        }
+                        *exn = make_exn_value(ref(l->info),
+                                              "More than one key");
+                        unref(r, regexp);
+                        unref(k, regexp);
+                        return NULL;
                     } else {
                         k = r;
                     }




More information about the augeas-devel mailing list