[augeas-devel] augeas: master - * src/syntax.c (print_value): use print_tree instead of dump_tree

David Lutterkort lutter at fedoraproject.org
Thu Sep 3 20:46:41 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=1e6776618ac43135bd3e64c7d4107a73feac55de
Commit:        1e6776618ac43135bd3e64c7d4107a73feac55de
Parent:        034eac6ffaa94850c19cda6bb4b3613fbb8d12de
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Thu Sep 3 11:54:01 2009 -0700
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Sep 3 11:54:54 2009 -0700

* src/syntax.c (print_value): use print_tree instead of dump_tree

---
 src/syntax.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/syntax.c b/src/syntax.c
index 7b5dfaa..9c643f8 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -652,6 +652,25 @@ static void dump_ctx(struct ctx *ctx) {
 /*
  * Values
  */
+static void print_tree(FILE *out, int indent, struct tree *tree) {
+    list_for_each(t, tree) {
+        for (int i=0; i < indent; i++) fputc(' ', out);
+        fprintf(out, "{ ");
+        if (t->label != NULL)
+            fprintf(out, "\"%s\"", t->label);
+        if (t->value != NULL)
+            fprintf(out, " = \"%s\"", t->value);
+        if (t->children != NULL) {
+            fputc('\n', out);
+            print_tree(out, indent + 2, t->children);
+            for (int i=0; i < indent; i++) fputc(' ', out);
+        } else {
+            fputc(' ', out);
+        }
+        fprintf(out, "}\n");
+    }
+}
+
 static void print_value(FILE *out, struct value *v) {
     if (v == NULL) {
         fprintf(out, "<null>");
@@ -671,7 +690,7 @@ static void print_value(FILE *out, struct value *v) {
         fprintf(out, ">");
         break;
     case V_TREE:
-        dump_tree(stdout, v->origin);
+        print_tree(stdout, 0, v->origin);
         break;
     case V_FILTER:
         fprintf(out, "<filter:");
@@ -1642,25 +1661,6 @@ static struct value *compile_exp(struct info *info,
     return v;
 }
 
-static void print_tree(FILE *out, int indent, struct tree *tree) {
-    list_for_each(t, tree) {
-        for (int i=0; i < indent; i++) fputc(' ', out);
-        fprintf(out, "{ ");
-        if (t->label != NULL)
-            fprintf(out, "\"%s\"", t->label);
-        if (t->value != NULL)
-            fprintf(out, " = \"%s\"", t->value);
-        if (t->children != NULL) {
-            fputc('\n', out);
-            print_tree(out, indent + 2, t->children);
-            for (int i=0; i < indent; i++) fputc(' ', out);
-        } else {
-            fputc(' ', out);
-        }
-        fprintf(out, "}\n");
-    }
-}
-
 static int compile_test(struct term *term, struct ctx *ctx) {
     struct value *actual = compile_exp(term->info, term->test, ctx);
     struct value *expect = NULL;




More information about the augeas-devel mailing list