aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rbtree.c
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2012-10-08 19:31:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:22:35 -0400
commit7ce6ff9e5de99e7b72019c7de82fb438fe1dc5a0 (patch)
tree8caa4509f6421f5e923a1dc361013db629f80f54 /lib/rbtree.c
parent6280d2356fd8ad0936a63c10dc1e6accf48d0c61 (diff)
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>
Diffstat (limited to 'lib/rbtree.c')
-rw-r--r--lib/rbtree.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/lib/rbtree.c b/lib/rbtree.c
index a38e473d8fe7..08926709b4f9 100644
--- a/lib/rbtree.c
+++ b/lib/rbtree.c
@@ -363,8 +363,7 @@ void rb_erase(struct rb_node *node, struct rb_root *root)
363 child = node->rb_right; 363 child = node->rb_right;
364 else if (!node->rb_right) 364 else if (!node->rb_right)
365 child = node->rb_left; 365 child = node->rb_left;
366 else 366 else {
367 {
368 struct rb_node *old = node, *left; 367 struct rb_node *old = node, *left;
369 368
370 node = node->rb_right; 369 node = node->rb_right;
@@ -406,17 +405,15 @@ void rb_erase(struct rb_node *node, struct rb_root *root)
406 405
407 if (child) 406 if (child)
408 rb_set_parent(child, parent); 407 rb_set_parent(child, parent);
409 if (parent) 408 if (parent) {
410 {
411 if (parent->rb_left == node) 409 if (parent->rb_left == node)
412 parent->rb_left = child; 410 parent->rb_left = child;
413 else 411 else
414 parent->rb_right = child; 412 parent->rb_right = child;
415 } 413 } else
416 else
417 root->rb_node = child; 414 root->rb_node = child;
418 415
419 color: 416color:
420 if (color == RB_BLACK) 417 if (color == RB_BLACK)
421 __rb_erase_color(child, parent, root); 418 __rb_erase_color(child, parent, root);
422} 419}
@@ -529,8 +526,10 @@ struct rb_node *rb_next(const struct rb_node *node)
529 if (RB_EMPTY_NODE(node)) 526 if (RB_EMPTY_NODE(node))
530 return NULL; 527 return NULL;
531 528
532 /* If we have a right-hand child, go down and then left as far 529 /*
533 as we can. */ 530 * If we have a right-hand child, go down and then left as far
531 * as we can.
532 */
534 if (node->rb_right) { 533 if (node->rb_right) {
535 node = node->rb_right; 534 node = node->rb_right;
536 while (node->rb_left) 535 while (node->rb_left)
@@ -538,12 +537,13 @@ struct rb_node *rb_next(const struct rb_node *node)
538 return (struct rb_node *)node; 537 return (struct rb_node *)node;
539 } 538 }
540 539
541 /* No right-hand children. Everything down and left is 540 /*
542 smaller than us, so any 'next' node must be in the general 541 * No right-hand children. Everything down and left is smaller than us,
543 direction of our parent. Go up the tree; any time the 542 * so any 'next' node must be in the general direction of our parent.
544 ancestor is a right-hand child of its parent, keep going 543 * Go up the tree; any time the ancestor is a right-hand child of its
545 up. First time it's a left-hand child of its parent, said 544 * parent, keep going up. First time it's a left-hand child of its
546 parent is our 'next' node. */ 545 * parent, said parent is our 'next' node.
546 */
547 while ((parent = rb_parent(node)) && node == parent->rb_right) 547 while ((parent = rb_parent(node)) && node == parent->rb_right)
548 node = parent; 548 node = parent;
549 549
@@ -558,8 +558,10 @@ struct rb_node *rb_prev(const struct rb_node *node)
558 if (RB_EMPTY_NODE(node)) 558 if (RB_EMPTY_NODE(node))
559 return NULL; 559 return NULL;
560 560
561 /* If we have a left-hand child, go down and then right as far 561 /*
562 as we can. */ 562 * If we have a left-hand child, go down and then right as far
563 * as we can.
564 */
563 if (node->rb_left) { 565 if (node->rb_left) {
564 node = node->rb_left; 566 node = node->rb_left;
565 while (node->rb_right) 567 while (node->rb_right)
@@ -567,8 +569,10 @@ struct rb_node *rb_prev(const struct rb_node *node)
567 return (struct rb_node *)node; 569 return (struct rb_node *)node;
568 } 570 }
569 571
570 /* No left-hand children. Go up till we find an ancestor which 572 /*
571 is a right-hand child of its parent */ 573 * No left-hand children. Go up till we find an ancestor which
574 * is a right-hand child of its parent.
575 */
572 while ((parent = rb_parent(node)) && node == parent->rb_left) 576 while ((parent = rb_parent(node)) && node == parent->rb_left)
573 node = parent; 577 node = parent;
574 578