aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-08 23:30:01 +0200
committerDaniel Lezcano <daniel.lezcano@free.fr>2011-06-08 23:30:01 +0200
commitcb86e1da685c1b6d77e82b8df43434045583a6bd (patch)
treeb37764d81b8b07b3d7f7ddbe72e4f62c1ebf3261
parentfabe20a77d38e1e91ad0b7bf396a9f63d62c397e (diff)
downloadpowerdebug-cb86e1da685c1b6d77e82b8df43434045583a6bd.tar.gz
compute the number of children for a specific node
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--tree.c3
-rw-r--r--tree.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/tree.c b/tree.c
index 8f546a9..dd53ff2 100644
--- a/tree.c
+++ b/tree.c
@@ -57,6 +57,7 @@ static inline struct tree *tree_alloc(const char *path, int depth)
t->next = NULL;
t->prev = NULL;
t->private = NULL;
+ t->nrchild = 0;
return t;
}
@@ -161,6 +162,8 @@ static int tree_scan(struct tree *tree, tree_filter_t filter)
tree_add_child(tree, child);
+ tree->nrchild++;
+
ret = tree_scan(child, filter);
}
diff --git a/tree.h b/tree.h
index 88d4a19..c7f3ca9 100644
--- a/tree.h
+++ b/tree.h
@@ -33,6 +33,7 @@ struct tree {
char *path;
char *name;
void *private;
+ int nrchild;
unsigned char depth;
};