]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - buffer_tree.c
Major grab_client cleanups.
[paraslash.git] / buffer_tree.c
index a7a3220b4d267955ae5fe467d9e08b1c48b6a5f3..8aa66b6c7efce8a51e37ab2b52f4102f074d936d 100644 (file)
@@ -745,6 +745,25 @@ void btr_log_tree(struct btr_node *btrn, int loglevel)
        return log_tree_recursively(btrn, loglevel, 0);
 }
 
+/*
+ * \return \a root if \a name is \p NULL.
+ */
+struct btr_node *btr_search_node(const char *name, struct btr_node *root)
+{
+       struct btr_node *ch;
+
+       if (!name)
+               return root;
+       if (!strcmp(root->name, name))
+               return root;
+       FOR_EACH_CHILD(ch, root) {
+               struct btr_node *result = btr_search_node(name, ch);
+               if (result)
+                       return result;
+       }
+       return NULL;
+}
+
 /** 640K ought to be enough for everybody ;) */
 #define BTRN_MAX_PENDING (640 * 1024)