[augeas-devel] [PATCH 5 of 6] Properly determine if segment needs qualifier

David Lutterkort dlutter at redhat.com
Tue May 6 01:12:24 UTC 2008


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1210036245 25200
# Node ID 050726209f9d5eeff658a2e64f40eb64aa955e11
# Parent  e68744ad2a0b41dce0abbaa4185932d7f75922a1
Properly determine if segment needs qualifier

For segments with label NULL, we didn't qualify the first sibling with the
NULL label since we were comparing NULL to the result of seg_label, which
was "(none)"

diff -r e68744ad2a0b -r 050726209f9d src/augeas.c
--- a/src/augeas.c	Mon May 05 18:10:02 2008 -0700
+++ b/src/augeas.c	Mon May 05 18:10:45 2008 -0700
@@ -330,14 +330,12 @@ static const char *seg_label(struct segm
 
 static int seg_needs_qual(struct path *path, struct segment *seg) {
     struct tree *siblings;
-    const char *label;
 
     if (seg->index > 1)
         return 1;
     siblings = (seg == path->segments) ? path->root : (seg-1)->tree->children;
-    label = seg_label(seg);
     list_for_each(t, siblings) {
-        if (t != seg->tree && streqv(t->label, label))
+        if (t != seg->tree && streqv(t->label, seg->tree->label))
             return 1;
     }
     return 0;




More information about the augeas-devel mailing list