rbtree: coding style adjustments

Set comment and indentation style to be consistent with linux coding style
and the rest of the file, as suggested by Peter Zijlstra

Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Daniel Santos <daniel.santos@pobox.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Michel Lespinasse 2012-10-08 16:31:01 -07:00 committed by Linus Torvalds
parent 6280d2356f
commit 7ce6ff9e5d
1 changed files with 23 additions and 19 deletions

View File

@ -363,8 +363,7 @@ void rb_erase(struct rb_node *node, struct rb_root *root)
child = node->rb_right; child = node->rb_right;
else if (!node->rb_right) else if (!node->rb_right)
child = node->rb_left; child = node->rb_left;
else else {
{
struct rb_node *old = node, *left; struct rb_node *old = node, *left;
node = node->rb_right; node = node->rb_right;
@ -406,17 +405,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);
if (parent) if (parent) {
{
if (parent->rb_left == node) if (parent->rb_left == node)
parent->rb_left = child; parent->rb_left = child;
else else
parent->rb_right = child; parent->rb_right = child;
} } else
else
root->rb_node = child; root->rb_node = child;
color: color:
if (color == RB_BLACK) if (color == RB_BLACK)
__rb_erase_color(child, parent, root); __rb_erase_color(child, parent, root);
} }
@ -529,8 +526,10 @@ struct rb_node *rb_next(const struct rb_node *node)
if (RB_EMPTY_NODE(node)) if (RB_EMPTY_NODE(node))
return NULL; return NULL;
/* If we have a right-hand child, go down and then left as far /*
as we can. */ * If we have a right-hand child, go down and then left as far
* as we can.
*/
if (node->rb_right) { if (node->rb_right) {
node = node->rb_right; node = node->rb_right;
while (node->rb_left) while (node->rb_left)
@ -538,12 +537,13 @@ struct rb_node *rb_next(const struct rb_node *node)
return (struct rb_node *)node; return (struct rb_node *)node;
} }
/* No right-hand children. Everything down and left is /*
smaller than us, so any 'next' node must be in the general * No right-hand children. Everything down and left is smaller than us,
direction of our parent. Go up the tree; any time the * so any 'next' node must be in the general direction of our parent.
ancestor is a right-hand child of its parent, keep going * Go up the tree; any time the ancestor is a right-hand child of its
up. First time it's a left-hand child of its parent, said * parent, keep going up. First time it's a left-hand child of its
parent is our 'next' node. */ * parent, said parent is our 'next' node.
*/
while ((parent = rb_parent(node)) && node == parent->rb_right) while ((parent = rb_parent(node)) && node == parent->rb_right)
node = parent; node = parent;
@ -558,8 +558,10 @@ struct rb_node *rb_prev(const struct rb_node *node)
if (RB_EMPTY_NODE(node)) if (RB_EMPTY_NODE(node))
return NULL; return NULL;
/* If we have a left-hand child, go down and then right as far /*
as we can. */ * If we have a left-hand child, go down and then right as far
* as we can.
*/
if (node->rb_left) { if (node->rb_left) {
node = node->rb_left; node = node->rb_left;
while (node->rb_right) while (node->rb_right)
@ -567,8 +569,10 @@ struct rb_node *rb_prev(const struct rb_node *node)
return (struct rb_node *)node; return (struct rb_node *)node;
} }
/* No left-hand children. Go up till we find an ancestor which /*
is a right-hand child of its parent */ * No left-hand children. Go up till we find an ancestor which
* is a right-hand child of its parent.
*/
while ((parent = rb_parent(node)) && node == parent->rb_left) while ((parent = rb_parent(node)) && node == parent->rb_left)
node = parent; node = parent;