aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rbtree.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbtree.c')
-rw-r--r--lib/rbtree.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/rbtree.c b/lib/rbtree.c
index 9956b99649f..f653659e0bc 100644
--- a/lib/rbtree.c
+++ b/lib/rbtree.c
@@ -163,17 +163,14 @@ static void __rb_erase_color(struct rb_node *node, struct rb_node *parent,
163 { 163 {
164 if (!other->rb_right || rb_is_black(other->rb_right)) 164 if (!other->rb_right || rb_is_black(other->rb_right))
165 { 165 {
166 struct rb_node *o_left; 166 rb_set_black(other->rb_left);
167 if ((o_left = other->rb_left))
168 rb_set_black(o_left);
169 rb_set_red(other); 167 rb_set_red(other);
170 __rb_rotate_right(other, root); 168 __rb_rotate_right(other, root);
171 other = parent->rb_right; 169 other = parent->rb_right;
172 } 170 }
173 rb_set_color(other, rb_color(parent)); 171 rb_set_color(other, rb_color(parent));
174 rb_set_black(parent); 172 rb_set_black(parent);
175 if (other->rb_right) 173 rb_set_black(other->rb_right);
176 rb_set_black(other->rb_right);
177 __rb_rotate_left(parent, root); 174 __rb_rotate_left(parent, root);
178 node = root->rb_node; 175 node = root->rb_node;
179 break; 176 break;
@@ -200,17 +197,14 @@ static void __rb_erase_color(struct rb_node *node, struct rb_node *parent,
200 { 197 {
201 if (!other->rb_left || rb_is_black(other->rb_left)) 198 if (!other->rb_left || rb_is_black(other->rb_left))
202 { 199 {
203 register struct rb_node *o_right; 200 rb_set_black(other->rb_right);
204 if ((o_right = other->rb_right))
205 rb_set_black(o_right);
206 rb_set_red(other); 201 rb_set_red(other);
207 __rb_rotate_left(other, root); 202 __rb_rotate_left(other, root);
208 other = parent->rb_left; 203 other = parent->rb_left;
209 } 204 }
210 rb_set_color(other, rb_color(parent)); 205 rb_set_color(other, rb_color(parent));
211 rb_set_black(parent); 206 rb_set_black(parent);
212 if (other->rb_left) 207 rb_set_black(other->rb_left);
213 rb_set_black(other->rb_left);
214 __rb_rotate_right(parent, root); 208 __rb_rotate_right(parent, root);
215 node = root->rb_node; 209 node = root->rb_node;
216 break; 210 break;