[augeas-devel] augeas: master - Remember the jmt in the lens and free it when it is no loner needed
David Lutterkort
lutter at fedoraproject.org
Fri Jan 15 01:31:33 UTC 2010
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=a391169ac94d1111d2f9c44fbab3a968581ca912
Commit: a391169ac94d1111d2f9c44fbab3a968581ca912
Parent: e1b404516e614ff01bf7e5a86f4481156b069740
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Wed Dec 23 10:50:03 2009 -0800
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Jan 14 14:48:38 2010 -0800
Remember the jmt in the lens and free it when it is no loner needed
---
src/lens.c | 12 +++++++++++-
src/lens.h | 2 ++
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/lens.c b/src/lens.c
index 67d23d1..85d3932 100644
--- a/src/lens.c
+++ b/src/lens.c
@@ -777,6 +777,7 @@ void free_lens(struct lens *lens) {
case L_REC:
if (!lens->rec_internal) {
unref(lens->body, lens);
+ jmt_free(lens->jmt);
}
break;
default:
@@ -812,6 +813,11 @@ void lens_release(struct lens *lens) {
lens_release(lens->children[i]);
}
}
+
+ if (lens->tag == L_REC) {
+ jmt_free(lens->jmt);
+ lens->jmt = NULL;
+ }
}
/*
@@ -1980,6 +1986,9 @@ struct value *lns_check_rec(struct info *info,
if (result != NULL)
goto error;
+ struct jmt *jmt = jmt_build(rec);
+ ERR_BAIL(info);
+
result = lns_make_rec(ref(rec->info));
struct lens *top = result->lens;
for (int t=0; t < ntypes; t++)
@@ -1991,7 +2000,8 @@ struct value *lns_check_rec(struct info *info,
top->body = ref(body);
top->alias = rec;
rec->alias = top;
- ERR_BAIL(info);
+
+ top->jmt = jmt;
return result;
error:
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;
};
};
};
More information about the augeas-devel
mailing list