130 while (x !=
NULL && x->
key != key) {
161 if (x_parent == x_gparent->
left) {
170 if (x == x_parent->
right) {
174 x_gparent = x_parent->
parent;
190 if (x == x_parent->
left) {
194 x_gparent = x_parent->
parent;
288 BalancedTree_foreach_func,
void*);
292 BalancedTree_foreach_func func,
void* data)
294 BalancedTree_foreach_rec(tree->
root, func, data);
300 BalancedTree_foreach_func func,
void* data)
303 BalancedTree_foreach_rec(node->
left, func, data);
307 BalancedTree_foreach_rec(node->
right, func, data);
static BalancedTreeNode_t * BalancedTreeNode_alloc(BalancedTree_alloc_fn_t alloc, size_t dataSz)
static void spinlock_unlock(spinlock_t *l)
struct BalancedTreeNode * parent
void *(* BalancedTree_alloc_fn_t)(size_t)
BalancedTree_alloc_fn_t allocFn
struct BalancedTreeNode * right
void pfq_rwlock_init(pfq_rwlock_t *l)
void BalancedTreeNode_init(BalancedTreeNode_t *x, void *key, BalancedTreeNode_t *parent)
static void BalancedTree_rightRotate(BalancedTree_t *tree, BalancedTreeNode_t *y)
struct BalancedTreeNode * left
void pfq_rwlock_write_lock(pfq_rwlock_t *l, pfq_rwlock_node_t *me)
BalancedTreeNode_t * BalancedTree_insert(BalancedTree_t *tree, void *key)
void pfq_rwlock_write_unlock(pfq_rwlock_t *l, pfq_rwlock_node_t *me)
static void BalancedTree_leftRotate(BalancedTree_t *tree, BalancedTreeNode_t *x)
void BalancedTree_init(BalancedTree_t *tree, BalancedTree_alloc_fn_t allocFn, size_t nodeDataSz)
BalancedTreeNode_t * root
BalancedTreeColor_t color