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

[augeas-devel] augeas: master - * src/augeas.h (aug_init): make loading the tree optional



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=ad74a5d444cf1c0c81e77f80a3f892899b973ea3
Commit:        ad74a5d444cf1c0c81e77f80a3f892899b973ea3
Parent:        0165997a1c91eaba627b4ad5e92a5cc6f44ea789
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Wed Mar 18 10:33:36 2009 -0700
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Thu Mar 19 10:41:40 2009 -0700

* src/augeas.h (aug_init): make loading the tree optional

The new flag AUG_NO_LOAD can be used to keep aug_init from loading any
files. This gives the user a chance to modify /augeas/load and then call
aug_load.
---
 src/augeas.c |    5 +++--
 src/augeas.h |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/augeas.c b/src/augeas.c
index c3fc27a..42eaac3 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -278,8 +278,9 @@ struct augeas *aug_init(const char *root, const char *loadpath,
             continue;
         tree_from_transform(result, modl->name, xform);
     }
-    if (aug_load(result) < 0)
-        goto error;
+    if (!(result->flags & AUG_NO_LOAD))
+        if (aug_load(result) < 0)
+            goto error;
 
     return result;
 
diff --git a/src/augeas.h b/src/augeas.h
index b2f32f8..73deafe 100644
--- a/src/augeas.h
+++ b/src/augeas.h
@@ -44,8 +44,9 @@ enum aug_flags {
                                      expensive it is not done by default */
     AUG_NO_STDINC    = (1 << 3),   /* Do not use the builtin load path for
                                      modules */
-    AUG_SAVE_NOOP    = (1 << 4)   /* Make save a no-op process, just record
+    AUG_SAVE_NOOP    = (1 << 4),  /* Make save a no-op process, just record
                                      what would have changed */
+    AUG_NO_LOAD      = (1 << 5)   /* Do not load the tree from AUG_INIT */
 };
 
 /* Function: aug_init



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