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

[augeas-devel] [PATCH 11/16] * src/put.c: put/create for recursive lenses



From: David Lutterkort <lutter redhat com>

---
 src/put.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/put.c b/src/put.c
index 2b4e60f..16026cd 100644
--- a/src/put.c
+++ b/src/put.c
@@ -409,6 +409,8 @@ static int skel_instance_of(struct lens *lens, struct skel *skel) {
                 return 0;
         }
         return 1;
+    case L_REC:
+        return skel_instance_of(lens->body, skel);
     default:
         assert_error_at(__FILE__, __LINE__, lens->info,
                         "illegal lens tag %d", lens->tag);
@@ -554,6 +556,10 @@ static void put_store(struct lens *lens, struct state *state) {
     }
 }
 
+static void put_rec(struct lens *lens, struct state *state) {
+    put_lens(lens->body, state);
+}
+
 static void put_lens(struct lens *lens, struct state *state) {
     if (state->error != NULL)
         return;
@@ -592,6 +598,9 @@ static void put_lens(struct lens *lens, struct state *state) {
     case L_MAYBE:
         put_quant_maybe(lens, state);
         break;
+    case L_REC:
+        put_rec(lens, state);
+        break;
     default:
         assert(0);
         break;
@@ -667,6 +676,10 @@ static void create_quant_maybe(struct lens *lens, struct state *state) {
     }
 }
 
+static void create_rec(struct lens *lens, struct state *state) {
+    create_lens(lens->body, state);
+}
+
 static void create_lens(struct lens *lens, struct state *state) {
     if (state->error != NULL)
         return;
@@ -704,6 +717,9 @@ static void create_lens(struct lens *lens, struct state *state) {
     case L_MAYBE:
         create_quant_maybe(lens, state);
         break;
+    case L_REC:
+        create_rec(lens, state);
+        break;
     default:
         assert(0);
         break;
-- 
1.6.5.2



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