Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b324126 authored by Wolfram Strepp's avatar Wolfram Strepp Committed by Linus Torvalds
Browse files

rb_tree: remove redundant if()-condition in rb_erase()



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: default avatarWolfram Strepp <wstrepp@gmx.de>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4c601178
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -250,15 +250,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;
	}
	}