rbtree.c: Remove unused rb_replace_node().
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 3 Jan 2015 17:02:12 +0000 (17:02 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 18 Feb 2015 14:08:57 +0000 (15:08 +0100)
Found by cppcheck.

rbtree.c
rbtree.h

index 2b87c8b3525ae50b5ff61541a896e9787a9280aa..3cad749620a769b637d68c2dd277d244190b57ec 100644 (file)
--- a/rbtree.c
+++ b/rbtree.c
@@ -382,29 +382,6 @@ struct rb_node *rb_prev(const struct rb_node *node)
        return parent;
 }
 
-void rb_replace_node(struct rb_node *victim, struct rb_node *new,
-                    struct rb_root *root)
-{
-       struct rb_node *parent = rb_parent(victim);
-
-       /* Set the surrounding nodes to point to the replacement */
-       if (parent) {
-               if (victim == parent->rb_left)
-                       parent->rb_left = new;
-               else
-                       parent->rb_right = new;
-       } else {
-               root->rb_node = new;
-       }
-       if (victim->rb_left)
-               rb_set_parent(victim->rb_left, new);
-       if (victim->rb_right)
-               rb_set_parent(victim->rb_right, new);
-
-       /* Copy the pointers/colour from the victim to the replacement */
-       *new = *victim;
-}
-
 /**
  * Get the n-th node (in sort order) of the tree.
  *
index 109dd856c1c99aa450fb05abb5e5f32f1eb3df06..4bf49178f5fb9d9e790fba33d99ca9116dd2816d 100644 (file)
--- a/rbtree.h
+++ b/rbtree.h
@@ -154,10 +154,6 @@ extern struct rb_node *rb_last(const struct rb_root *);
 extern struct rb_node *rb_nth(const struct rb_node *node, unsigned n);
 extern int rb_rank(const struct rb_node *node, unsigned *rank);
 
-/* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
-                           struct rb_root *root);
-
 static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
                                struct rb_node ** rb_link)
 {