[sheepdog] [PATCH 4/5] rbtree: remove unused augment functions
Liu Yuan
namei.unix at gmail.com
Thu Sep 5 06:38:12 CEST 2013
We are unlikely to use them in the future. So remove it.
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
include/rbtree.h | 8 -------
lib/rbtree.c | 68 ------------------------------------------------------
2 files changed, 76 deletions(-)
diff --git a/include/rbtree.h b/include/rbtree.h
index b3b023e..c926cff 100644
--- a/include/rbtree.h
+++ b/include/rbtree.h
@@ -53,14 +53,6 @@ static inline void rb_init_node(struct rb_node *rb)
void rb_insert_color(struct rb_node *, struct rb_root *);
void rb_erase(struct rb_node *, struct rb_root *);
-typedef void (*rb_augment_f)(struct rb_node *node, void *data);
-
-void rb_augment_insert(struct rb_node *node,
- rb_augment_f func, void *data);
-struct rb_node *rb_augment_erase_begin(struct rb_node *node);
-void rb_augment_erase_end(struct rb_node *node,
- rb_augment_f func, void *data);
-
/* Find logical next and previous nodes in a tree */
struct rb_node *rb_next(const struct rb_node *);
struct rb_node *rb_prev(const struct rb_node *);
diff --git a/lib/rbtree.c b/lib/rbtree.c
index 0db1054..1e54659 100644
--- a/lib/rbtree.c
+++ b/lib/rbtree.c
@@ -251,74 +251,6 @@ void rb_erase(struct rb_node *node, struct rb_root *root)
__rb_erase_color(child, parent, root);
}
-static void rb_augment_path(struct rb_node *node, rb_augment_f func, void *data)
-{
- struct rb_node *parent;
-
-up:
- func(node, data);
- parent = rb_parent(node);
- if (!parent)
- return;
-
- if (node == parent->rb_left && parent->rb_right)
- func(parent->rb_right, data);
- else if (parent->rb_left)
- func(parent->rb_left, data);
-
- node = parent;
- goto up;
-}
-
-/*
- * after inserting @node into the tree, update the tree to account for
- * both the new entry and any damage done by rebalance
- */
-void rb_augment_insert(struct rb_node *node, rb_augment_f func, void *data)
-{
- if (node->rb_left)
- node = node->rb_left;
- else if (node->rb_right)
- node = node->rb_right;
-
- rb_augment_path(node, func, data);
-}
-
-/*
- * before removing the node, find the deepest node on the rebalance path
- * that will still be there after @node gets removed
- */
-struct rb_node *rb_augment_erase_begin(struct rb_node *node)
-{
- struct rb_node *deepest;
-
- if (!node->rb_right && !node->rb_left)
- deepest = rb_parent(node);
- else if (!node->rb_right)
- deepest = node->rb_left;
- else if (!node->rb_left)
- deepest = node->rb_right;
- else {
- deepest = rb_next(node);
- if (deepest->rb_right)
- deepest = deepest->rb_right;
- else if (rb_parent(deepest) != node)
- deepest = rb_parent(deepest);
- }
-
- return deepest;
-}
-
-/*
- * after removal, update the tree to account for the removed entry
- * and any rebalance damage.
- */
-void rb_augment_erase_end(struct rb_node *node, rb_augment_f func, void *data)
-{
- if (node)
- rb_augment_path(node, func, data);
-}
-
/* This function returns the first node (in sort order) of the tree. */
struct rb_node *rb_first(const struct rb_root *root)
{
--
1.7.9.5
More information about the sheepdog
mailing list