Rework RBTree to use RBNode in the compare function
This commit is contained in:
+3
-3
@@ -251,11 +251,11 @@ uc_rb_remove(RBTree *root, RBNode *node)
|
||||
}
|
||||
|
||||
RBNode*
|
||||
uc_rb_find(RBTree *root, const void *val)
|
||||
uc_rb_find(RBTree *root, const RBNode *val)
|
||||
{
|
||||
RBNode *n = root->node;
|
||||
while (n) {
|
||||
int d = root->compare(val,n->data);
|
||||
int d = root->compare(val,n);
|
||||
if (d < 0)
|
||||
n = n->left;
|
||||
else if (d > 0)
|
||||
@@ -274,7 +274,7 @@ uc_rb_insert(RBTree *root, RBNode *child)
|
||||
int d;
|
||||
while (*p) {
|
||||
parent = *p;
|
||||
d = root->compare(child->data, parent->data);
|
||||
d = root->compare(child, parent);
|
||||
if (d < 0)
|
||||
p = &(*p)->left;
|
||||
else if (d > 0)
|
||||
|
||||
Reference in New Issue
Block a user