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

[augeas-devel] augeas: master - * src/internal.h: make various tree management functions available



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=41fd642104b7e254c6ff950dc30d1dd0afcf61a9
Commit:        41fd642104b7e254c6ff950dc30d1dd0afcf61a9
Parent:        d545e20ea9ca369423ea2b567998779b7bc61e1c
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Wed Jan 6 15:09:14 2010 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Thu Jan 7 11:45:04 2010 -0800

* src/internal.h: make various tree management functions available

---
 src/augeas.c   |   11 +++++------
 src/internal.h |   12 ++++++++++++
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/augeas.c b/src/augeas.c
index 0f236fa..1fb7842 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -81,7 +81,7 @@ static void tree_clean(struct tree *tree) {
     tree->dirty = 0;
 }
 
-static struct tree *tree_child(struct tree *tree, const char *label) {
+struct tree *tree_child(struct tree *tree, const char *label) {
     if (tree == NULL)
         return NULL;
 
@@ -92,8 +92,7 @@ static struct tree *tree_child(struct tree *tree, const char *label) {
     return NULL;
 }
 
-/* Get first existing child or create one */
-static struct tree *tree_child_cr(struct tree *tree, const char *label) {
+struct tree *tree_child_cr(struct tree *tree, const char *label) {
     static struct tree *child = NULL;
 
     if (tree == NULL)
@@ -109,7 +108,7 @@ static struct tree *tree_child_cr(struct tree *tree, const char *label) {
     return child;
 }
 
-static struct tree *tree_path_cr(struct tree *tree, int n, ...) {
+struct tree *tree_path_cr(struct tree *tree, int n, ...) {
     va_list ap;
 
     va_start(ap, n);
@@ -121,7 +120,7 @@ static struct tree *tree_path_cr(struct tree *tree, int n, ...) {
     return tree;
 }
 
-static int tree_set_value(struct tree *tree, const char *value) {
+int tree_set_value(struct tree *tree, const char *value) {
     if (tree->value != NULL) {
         free(tree->value);
         tree->value = NULL;
@@ -393,7 +392,7 @@ struct augeas *aug_init(const char *root, const char *loadpath,
     return NULL;
 }
 
-static void tree_unlink_children(struct augeas *aug, struct tree *tree) {
+void tree_unlink_children(struct augeas *aug, struct tree *tree) {
     if (tree == NULL)
         return;
 
diff --git a/src/internal.h b/src/internal.h
index cbdfa30..5189a83 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -376,6 +376,18 @@ int dump_tree(FILE *out, struct tree *tree);
 int tree_equal(const struct tree *t1, const struct tree *t2);
 char *path_expand(struct tree *tree, const char *ppath);
 char *path_of_tree(struct tree *tree);
+/* Return first child with label LABEL or NULL */
+struct tree *tree_child(struct tree *tree, const char *label);
+/* Return first existing child with label LABEL or create one. Return NULL
+ * when allocation fails */
+struct tree *tree_child_cr(struct tree *tree, const char *label);
+/* Create a path in the tree; nodes along the path are looked up with
+ * tree_child_cr */
+struct tree *tree_path_cr(struct tree *tree, int n, ...);
+/* Set the value of TREE and update dirty flags */
+int tree_set_value(struct tree *tree, const char *value);
+/* Cleanly remove all children of TREE, but leave TREE itself unchanged */
+void tree_unlink_children(struct augeas *aug, struct tree *tree);
 
 /* Struct: memstream
  * Wrappers to simulate OPEN_MEMSTREAM where that's not available. The



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