summaryrefslogtreecommitdiff
path: root/filter/tree.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-11-07 10:09:40 +0100
committerMaria Matejka <mq@ucw.cz>2022-11-07 10:18:19 +0100
commit96d380405701bb01d792ff1c867a607d7fefa001 (patch)
tree08477327585a486667ade126b9bd51713e461608 /filter/tree.c
parent34e803c6c32032cffeb9bd230d0f85861acd9222 (diff)
parent8478de8817c58af02f7aed1d621013891115a2dc (diff)
Merge commit '8478de88' into thread-next
Diffstat (limited to 'filter/tree.c')
-rw-r--r--filter/tree.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/filter/tree.c b/filter/tree.c
index 5da86b9d..97bf7dae 100644
--- a/filter/tree.c
+++ b/filter/tree.c
@@ -134,6 +134,14 @@ same_tree(const struct f_tree *t1, const struct f_tree *t2)
return 1;
}
+int
+tree_node_count(const struct f_tree *t)
+{
+ if (t == NULL)
+ return 0;
+
+ return 1 + tree_node_count(t->left) + tree_node_count(t->right);
+}
static void
tree_node_format(const struct f_tree *t, buffer *buf)