Lines Matching refs:rbt

127 rbt_copy_data(RBTree *rbt, RBTNode *dest, const RBTNode *src)  in rbt_copy_data()  argument
129 memcpy(dest + 1, src + 1, rbt->node_size - sizeof(RBTNode)); in rbt_copy_data()
145 rbt_find(RBTree *rbt, const RBTNode *data) in rbt_find() argument
147 RBTNode *node = rbt->root; in rbt_find()
151 int cmp = rbt->comparator(data, node, rbt->arg); in rbt_find()
173 rbt_leftmost(RBTree *rbt) in rbt_leftmost() argument
175 RBTNode *node = rbt->root; in rbt_leftmost()
176 RBTNode *leftmost = rbt->root; in rbt_leftmost()
201 rbt_rotate_left(RBTree *rbt, RBTNode *x) in rbt_rotate_left() argument
222 rbt->root = y; in rbt_rotate_left()
238 rbt_rotate_right(RBTree *rbt, RBTNode *x) in rbt_rotate_right() argument
259 rbt->root = y; in rbt_rotate_right()
282 rbt_insert_fixup(RBTree *rbt, RBTNode *x) in rbt_insert_fixup() argument
288 while (x != rbt->root && x->parent->color == RBTRED) in rbt_insert_fixup()
326 rbt_rotate_left(rbt, x); in rbt_insert_fixup()
333 rbt_rotate_right(rbt, x->parent->parent); in rbt_insert_fixup()
356 rbt_rotate_right(rbt, x); in rbt_insert_fixup()
361 rbt_rotate_left(rbt, x->parent->parent); in rbt_insert_fixup()
370 rbt->root->color = RBTBLACK; in rbt_insert_fixup()
391 rbt_insert(RBTree *rbt, const RBTNode *data, bool *isNew) in rbt_insert() argument
399 current = rbt->root; in rbt_insert()
405 cmp = rbt->comparator(data, current, rbt->arg); in rbt_insert()
411 rbt->combiner(current, data, rbt->arg); in rbt_insert()
424 x = rbt->allocfunc(rbt->arg); in rbt_insert()
431 rbt_copy_data(rbt, x, data); in rbt_insert()
443 rbt->root = x; in rbt_insert()
446 rbt_insert_fixup(rbt, x); in rbt_insert()
459 rbt_delete_fixup(RBTree *rbt, RBTNode *x) in rbt_delete_fixup() argument
466 while (x != rbt->root && x->color == RBTBLACK) in rbt_delete_fixup()
484 rbt_rotate_left(rbt, x->parent); in rbt_delete_fixup()
501 rbt_rotate_right(rbt, w); in rbt_delete_fixup()
508 rbt_rotate_left(rbt, x->parent); in rbt_delete_fixup()
509 x = rbt->root; /* Arrange for loop to terminate. */ in rbt_delete_fixup()
521 rbt_rotate_right(rbt, x->parent); in rbt_delete_fixup()
538 rbt_rotate_left(rbt, w); in rbt_delete_fixup()
545 rbt_rotate_right(rbt, x->parent); in rbt_delete_fixup()
546 x = rbt->root; /* Arrange for loop to terminate. */ in rbt_delete_fixup()
557 rbt_delete_node(RBTree *rbt, RBTNode *z) in rbt_delete_node() argument
601 rbt->root = x; in rbt_delete_node()
609 rbt_copy_data(rbt, z, y); in rbt_delete_node()
616 rbt_delete_fixup(rbt, x); in rbt_delete_node()
619 if (rbt->freefunc) in rbt_delete_node()
620 rbt->freefunc(y, rbt->arg); in rbt_delete_node()
633 rbt_delete(RBTree *rbt, RBTNode *node) in rbt_delete() argument
635 rbt_delete_node(rbt, node); in rbt_delete()
647 iter->last_visited = iter->rbt->root; in rbt_left_right_iterator()
689 iter->last_visited = iter->rbt->root; in rbt_right_left_iterator()
740 rbt_begin_iterate(RBTree *rbt, RBTOrderControl ctrl, RBTreeIterator *iter) in rbt_begin_iterate() argument
743 iter->rbt = rbt; in rbt_begin_iterate()
745 iter->is_over = (rbt->root == RBTNIL); in rbt_begin_iterate()