]> granicus.if.org Git - sudo/commitdiff
In rbrepair(), make sure we never try to change the color of the
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jan 2013 21:24:29 +0000 (16:24 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jan 2013 21:24:29 +0000 (16:24 -0500)
sentinel node, which is the first entry, not the root.
From Michael King

--HG--
branch : 1.7

CONTRIBUTORS
redblack.c

index 27544619235460ed71f01e201a832e116e6c25df..d63a74467aaf17de15e5729656efa2fd652d2fb9 100644 (file)
@@ -71,6 +71,7 @@ you believe you should be listed, please send a note to sudo@sudo.ws.
     Stepan Kasal
     Mike Kienenberger
     Dale King
+    Michael King
     Jim Knoble
     Tim Knox
     Alek O. Komarnitsky
@@ -116,7 +117,7 @@ you believe you should be listed, please send a note to sudo@sudo.ws.
     Diego Elio Petteno
     Joel Pickett
     Alex Plotnick
-    Tran Ngoc Quan 
+    Tran Ngoc Quan
     Gudleik Rasch
     Matt Richards
     Guido van Rossum
index fb3611b2d06004e0c1707d869246e4a6cd25474c..04adae64f225ca0f4ff420255a55b255daa64774 100644 (file)
@@ -418,7 +418,7 @@ rbrepair(tree, node)
 {
     struct rbnode *sibling;
 
-    while (node->color == black && node != rbroot(tree)) {
+    while (node->color == black && node != rbfirst(tree)) {
        if (node == node->parent->left) {
            sibling = node->parent->right;
            if (sibling->color == red) {
@@ -441,7 +441,7 @@ rbrepair(tree, node)
                node->parent->color = black;
                sibling->right->color = black;
                rotate_left(tree, node->parent);
-               node = rbroot(tree); /* exit loop */
+               node = rbfirst(tree); /* exit loop */
            }
        } else { /* if (node == node->parent->right) */
            sibling = node->parent->left;
@@ -465,7 +465,7 @@ rbrepair(tree, node)
                node->parent->color = black;
                sibling->left->color = black;
                rotate_right(tree, node->parent);
-               node = rbroot(tree); /* exit loop */
+               node = rbfirst(tree); /* exit loop */
            }
        }
     }