[augeas-devel] [PATCH 2/6] Calls to __aug_load_module need to go through api_entry/api_exit
David Lutterkort
lutter at redhat.com
Fri Oct 23 17:30:09 UTC 2009
---
src/augeas.c | 7 +++++++
src/internal.h | 3 +++
src/syntax.c | 4 ++--
src/syntax.h | 3 +--
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/augeas.c b/src/augeas.c
index f29dbb7..59d3743 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -1136,6 +1136,13 @@ void aug_close(struct augeas *aug) {
free(aug);
}
+int __aug_load_module_file(struct augeas *aug, const char *filename) {
+ api_entry(aug);
+ int r = load_module_file(aug, filename);
+ api_exit(aug);
+ return r;
+}
+
int tree_equal(const struct tree *t1, const struct tree *t2) {
while (t1 != NULL && t2 != NULL) {
if (!streqv(t1->label, t2->label))
diff --git a/src/internal.h b/src/internal.h
index fa286bb..55aa551 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -302,6 +302,9 @@ static inline struct error *err_of_aug(const struct augeas *aug) {
return ((struct augeas *) aug)->error;
}
+/* Used by augparse for loading tests */
+int __aug_load_module_file(struct augeas *aug, const char *filename);
+
/* Struct: tree
* An entry in the global config tree. The data structure allows associating
* values with interior nodes, but the API currently marks that as an error.
diff --git a/src/syntax.c b/src/syntax.c
index 63c88ea..edaa873 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1913,7 +1913,7 @@ static char *module_filename(struct augeas *aug, const char *modname) {
return filename;
}
-int __aug_load_module_file(struct augeas *aug, const char *filename) {
+int load_module_file(struct augeas *aug, const char *filename) {
struct term *term = NULL;
int result = -1;
@@ -1945,7 +1945,7 @@ static int load_module(struct augeas *aug, const char *name) {
if ((filename = module_filename(aug, name)) == NULL)
return -1;
- if (__aug_load_module_file(aug, filename) == -1)
+ if (load_module_file(aug, filename) == -1)
goto error;
free(filename);
diff --git a/src/syntax.h b/src/syntax.h
index e0698bb..cf5024a 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -264,8 +264,7 @@ int define_native_intl(const char *fname, int line,
struct module *builtin_init(struct error *);
-/* Used by augparse for some testing */
-int __aug_load_module_file(struct augeas *aug, const char *filename);
+int load_module_file(struct augeas *aug, const char *filename);
int interpreter_init(struct augeas *aug);
--
1.6.2.5
More information about the augeas-devel
mailing list