A small rbtree delete fixup optimization.

Setting node color to black is not required here because
it is already black.  Besides in the original algorithm
the node pointer is discarded and the node is set to tree
root just to quit the loop.

Thanks to 洪志道 (Hong Zhi Dao).
This commit is contained in:
Igor Sysoev
2017-05-29 10:17:36 +03:00
parent 5cca4b3ab7
commit f5c3b1c637

View File

@@ -399,7 +399,7 @@ nxt_rbtree_delete_fixup(nxt_rbtree_t *tree, nxt_rbtree_node_t *node)
nxt_rbtree_left_rotate(parent);
break;
return;
} else {
sibling = parent->left;
@@ -437,7 +437,7 @@ nxt_rbtree_delete_fixup(nxt_rbtree_t *tree, nxt_rbtree_node_t *node)
nxt_rbtree_right_rotate(parent);
break;
return;
}
}