core/rbtree: remove redundant if()-condition in rb_erase()

See kernel commit 4b324126e0c6c3a5080ca3ec0981e8766ed6f1ee

----
Furthermore, notice that the initial checks:

        if (!node->rb_left)
                child = node->rb_right;
        else if (!node->rb_right)
                child = node->rb_left;
        else
        {
                ...
        }
guarantee that old->rb_right is set in the final else branch, therefore
we can omit checking that again.

Signed-off-by: Wolfram Strepp <wstrepp@gmx.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
----

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2011-11-11 15:31:01 +01:00 committed by Harald Welte
parent a83cbe12f8
commit 54187ba442
1 changed files with 4 additions and 4 deletions

View File

@ -248,15 +248,15 @@ void rb_erase(struct rb_node *node, struct rb_root *root)
if (child) if (child)
rb_set_parent(child, parent); rb_set_parent(child, parent);
parent->rb_left = child; parent->rb_left = child;
node->rb_right = old->rb_right;
rb_set_parent(old->rb_right, node);
} }
node->rb_parent_color = old->rb_parent_color; node->rb_parent_color = old->rb_parent_color;
node->rb_right = old->rb_right;
node->rb_left = old->rb_left; node->rb_left = old->rb_left;
rb_set_parent(old->rb_left, node); rb_set_parent(old->rb_left, node);
if (old->rb_right)
rb_set_parent(old->rb_right, node);
goto color; goto color;
} }