61 #define RBTNIL (&sentinel)
114 tree->node_size = node_size;
115 tree->comparator = comparator;
116 tree->combiner = combiner;
117 tree->allocfunc = allocfunc;
118 tree->freefunc = freefunc;
181 if (equal_match &&
cmp == 0)
212 if (equal_match &&
cmp == 0)
274 y->parent =
x->parent;
277 if (
x ==
x->parent->left)
280 x->parent->right =
y;
307 y->right->parent =
x;
311 y->parent =
x->parent;
314 if (
x ==
x->parent->right)
315 x->parent->right =
y;
368 if (
x->parent ==
x->parent->parent->left)
377 x->parent->parent->color =
RBTRED;
379 x =
x->parent->parent;
384 if (
x ==
x->parent->right)
393 x->parent->parent->color =
RBTRED;
408 x->parent->parent->color =
RBTRED;
410 x =
x->parent->parent;
415 if (
x ==
x->parent->left)
421 x->parent->parent->color =
RBTRED;
537 if (
x ==
x->parent->left)
547 w =
x->parent->right;
564 w =
x->parent->right;
566 w->
color =
x->parent->color;
603 w->
color =
x->parent->color;
653 x->parent =
y->parent;
656 if (
y ==
y->parent->left)
659 y->parent->right =
x;
818 elog(
ERROR,
"unrecognized rbtree iteration order: %d", ctrl);
#define Assert(condition)
RBTNode * rbt_find_great(RBTree *rbt, const RBTNode *data, bool equal_match)
RBTNode * rbt_iterate(RBTreeIterator *iter)
static void rbt_delete_fixup(RBTree *rbt, RBTNode *x)
static void rbt_rotate_right(RBTree *rbt, RBTNode *x)
RBTNode * rbt_insert(RBTree *rbt, const RBTNode *data, bool *isNew)
static void rbt_insert_fixup(RBTree *rbt, RBTNode *x)
static void rbt_rotate_left(RBTree *rbt, RBTNode *x)
void rbt_begin_iterate(RBTree *rbt, RBTOrderControl ctrl, RBTreeIterator *iter)
static void rbt_delete_node(RBTree *rbt, RBTNode *z)
RBTree * rbt_create(Size node_size, rbt_comparator comparator, rbt_combiner combiner, rbt_allocfunc allocfunc, rbt_freefunc freefunc, void *arg)
RBTNode * rbt_find_less(RBTree *rbt, const RBTNode *data, bool equal_match)
static void rbt_copy_data(RBTree *rbt, RBTNode *dest, const RBTNode *src)
RBTNode * rbt_leftmost(RBTree *rbt)
static RBTNode * rbt_right_left_iterator(RBTreeIterator *iter)
static RBTNode * rbt_left_right_iterator(RBTreeIterator *iter)
void rbt_delete(RBTree *rbt, RBTNode *node)
RBTNode * rbt_find(RBTree *rbt, const RBTNode *data)
RBTNode *(* rbt_allocfunc)(void *arg)
void(* rbt_freefunc)(RBTNode *x, void *arg)
void(* rbt_combiner)(RBTNode *existing, const RBTNode *newdata, void *arg)
int(* rbt_comparator)(const RBTNode *a, const RBTNode *b, void *arg)
static int cmp(const chr *x, const chr *y, size_t len)
RBTNode *(* iterate)(RBTreeIterator *iter)
rbt_comparator comparator