mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Érsek László" <erseklaszlo@chello.hu>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] rbtree
Date: Sun, 24 Nov 2002 23:41:06 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.44.0211242332310.90-100000@lacos> (raw)
In-Reply-To: <200211241225.gAOCP3p05987@Port.imtp.ilyichevsk.odessa.ua>

Hi all,

this patch tries to remove those checks for 0 from
linux-2.4.19/lib/rbtree.c which are (I think) superfluous.

Laszlo Ersek


--- linux-2.4.19/lib/rbtree.c	Sat Aug  3 02:39:46 2002
+++ linux/lib/rbtree.c	Sun Nov 24 22:59:38 2002
@@ -159,17 +159,16 @@
 				if (!other->rb_right ||
 				    other->rb_right->rb_color == RB_BLACK)
 				{
-					register rb_node_t * o_left;
-					if ((o_left = other->rb_left))
-						o_left->rb_color = RB_BLACK;
+					/* unneeded check-for-0 removed */
+					other->rb_left->rb_color = RB_BLACK;
 					other->rb_color = RB_RED;
 					__rb_rotate_right(other, root);
 					other = parent->rb_right;
 				}
 				other->rb_color = parent->rb_color;
 				parent->rb_color = RB_BLACK;
-				if (other->rb_right)
-					other->rb_right->rb_color = RB_BLACK;
+				/* unneeded check-for-0 removed */
+				other->rb_right->rb_color = RB_BLACK;
 				__rb_rotate_left(parent, root);
 				node = root->rb_node;
 				break;
@@ -199,17 +198,16 @@
 				if (!other->rb_left ||
 				    other->rb_left->rb_color == RB_BLACK)
 				{
-					register rb_node_t * o_right;
-					if ((o_right = other->rb_right))
-						o_right->rb_color = RB_BLACK;
+					/* unneeded check-for-0 removed */
+					other->rb_right->rb_color = RB_BLACK;
 					other->rb_color = RB_RED;
 					__rb_rotate_left(other, root);
 					other = parent->rb_left;
 				}
 				other->rb_color = parent->rb_color;
 				parent->rb_color = RB_BLACK;
-				if (other->rb_left)
-					other->rb_left->rb_color = RB_BLACK;
+				/* unneeded check-for-0 removed */
+				other->rb_left->rb_color = RB_BLACK;
 				__rb_rotate_right(parent, root);
 				node = root->rb_node;
 				break;



       reply	other threads:[~2002-11-25  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200211241225.gAOCP3p05987@Port.imtp.ilyichevsk.odessa.ua>
2002-11-24 22:41 ` Érsek László [this message]
2002-11-25 21:01   ` Folkert van Heusden
2002-11-26 12:13     ` Mike Black

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0211242332310.90-100000@lacos \
    --to=erseklaszlo@chello.hu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®