]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
bintree: Give the bintree_ops pointer to the callback function
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 3 Jul 2010 12:39:08 +0000 (15:39 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 3 Jul 2010 13:03:30 +0000 (16:03 +0300)
This allows the callback to get status information if the caller has
embedded his opts structure inside of some other structure.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
bintree.c
bintree.h

index 6c0df4cd44a2eced748f826d9837327bafcb3586..c23394c67fba40bf3344deeaf665c997682759eb 100644 (file)
--- a/bintree.c
+++ b/bintree.c
@@ -53,7 +53,7 @@ int bintree_walk(struct bintree *tree, struct bintree_ops *ops)
                count += bintree_walk(tree->left, ops);
 
        if (ops->callback)
-               ops->callback(tree);
+               ops->callback(tree, ops);
 
        count++;
 
index f34660981ecc4f5cdd876ab198da9adec188a500..562a713e7a587fb5a20104347bb2966281b41c25 100644 (file)
--- a/bintree.h
+++ b/bintree.h
@@ -7,10 +7,11 @@ struct bintree {
 
 struct bintree_ops {
        int (*compare)(struct bintree *a, struct bintree *b);
-       void (*callback)(struct bintree *tree);
+       void (*callback)(struct bintree *tree, struct bintree_ops *ops);
 };
 
 struct bintree *bintree_add(struct bintree *tree, struct bintree *new,
                        struct bintree_ops *ops);
+int bintree_walk(struct bintree *tree, struct bintree_ops *ops);
 
 #endif