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

[augeas-devel] [PATCH 10/16] Remember the jmt in the lens and free it when it is no loner needed



From: David Lutterkort <lutter redhat com>

---
 src/lens.c |    8 ++++++++
 src/lens.h |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/lens.c b/src/lens.c
index 37566e8..600ec67 100644
--- a/src/lens.c
+++ b/src/lens.c
@@ -736,6 +736,7 @@ void free_lens(struct lens *lens) {
     case L_REC:
         if (!lens->rec_internal) {
             unref(lens->body, lens);
+            jmt_free(lens->jmt);
         }
         break;
     default:
@@ -768,6 +769,11 @@ void lens_release(struct lens *lens) {
             lens_release(lens->children[i]);
         }
     }
+
+    if (lens->tag == L_REC) {
+        jmt_free(lens->jmt);
+        lens->jmt = NULL;
+    }
 }
 
 /*
@@ -1942,6 +1948,8 @@ struct value *lns_check_rec(struct info *info,
     top->body = ref(body);
     top->alias = rec;
     rec->alias = top;
+
+    top->jmt = jmt_build(rec);
     ERR_BAIL(info);
 
     return result;
diff --git a/src/lens.h b/src/lens.h
index 8d2cf3f..e5a59bd 100644
--- a/src/lens.h
+++ b/src/lens.h
@@ -25,6 +25,7 @@
 
 #include "syntax.h"
 #include "fa.h"
+#include "jmt.h"
 
 enum lens_tag {
     L_DEL = 42,    /* Shift tag values so we fail fast(er) on bad pointers */
@@ -102,6 +103,7 @@ struct lens {
              * set up in lns_check_rec, and not reference counted.
              */
             struct lens *alias;
+            struct jmt  *jmt;
         };
     };
 };
-- 
1.6.5.2



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