18#define A_RBT_ROOT {A_NULL}
32#if defined(A_SIZE_POINTER) && (A_SIZE_POINTER + 0 > 1)
48#if defined(A_SIZE_POINTER) && (A_SIZE_POINTER + 0 > 1)
63#if defined(A_SIZE_POINTER) && (A_SIZE_POINTER + 0 > 1)
66 node->parent = parent;
88#if defined(__cplusplus)
209#if defined(__cplusplus)
219#define a_rbt_entry(ptr, type, member) a_container_of(ptr, type, member)
237#define a_rbt_foreach(cur, root) \
238 for (a_rbt_node *cur = a_rbt_head(root); cur; cur = a_rbt_next(cur))
256#define a_rbt_foreach_reverse(cur, root) \
257 for (a_rbt_node *cur = a_rbt_tail(root); cur; cur = a_rbt_prev(cur))
275#define a_rbt_pre_foreach(cur, root) \
276 for (a_rbt_node *cur = (root)->node; cur; cur = a_rbt_pre_next(cur))
294#define a_rbt_pre_foreach_reverse(cur, root) \
295 for (a_rbt_node *cur = (root)->node; cur; cur = a_rbt_pre_prev(cur))
313#define a_rbt_post_foreach(cur, root) \
314 for (a_rbt_node *cur = a_rbt_post_head(root); cur; cur = a_rbt_post_next(cur))
332#define a_rbt_post_foreach_reverse(cur, root) \
333 for (a_rbt_node *cur = a_rbt_post_tail(root); cur; cur = a_rbt_post_prev(cur))
352#define a_rbt_fortear(cur, next, root) \
353 for (a_rbt_node *next = A_NULL, *cur = a_rbt_tear(root, &next); cur; cur = a_rbt_tear(root, &next))
a_rbt_node * a_rbt_pre_next(a_rbt_node *node)
access next node of red–black binary search tree node preorder
a_rbt_node * a_rbt_head(a_rbt const *root)
access head node of red–black binary search tree in-order
a_rbt_node * a_rbt_next(a_rbt_node *node)
access next node of red–black binary search tree node in-order
struct a_rbt_node a_rbt_node
instance structure for red–black binary search tree node
void a_rbt_remove(a_rbt *root, a_rbt_node *node)
remove specified node from red–black binary search tree
a_rbt_node * a_rbt_post_prev(a_rbt_node *node)
access prev node of red–black binary search tree node postorder
a_rbt_node * a_rbt_post_head(a_rbt const *root)
access head node of red–black binary search tree postorder
union a_rbt a_rbt
instance structure for red–black binary search tree root
a_rbt_node * a_rbt_parent(a_rbt_node const *node)
access parent of red–black binary search tree node
Definition rbt.h:46
a_rbt_node * a_rbt_prev(a_rbt_node *node)
access prev node of red–black binary search tree node in-order
void a_rbt_insert_adjust(a_rbt *root, a_rbt_node *node)
rebalance the tree after insertion of the specified node
a_rbt_node * a_rbt_insert(a_rbt *root, a_rbt_node *node, int(*cmp)(void const *, void const *))
insert specified node into red–black binary search tree
a_rbt_node * a_rbt_pre_prev(a_rbt_node *node)
access prev node of red–black binary search tree node preorder
a_rbt_node * a_rbt_init(a_rbt_node *node, a_rbt_node *parent)
initialize for red–black binary search tree node
Definition rbt.h:61
a_rbt_node * a_rbt_tear(a_rbt *root, a_rbt_node **next)
tear a node from red–black binary search tree
a_rbt_node * a_rbt_post_next(a_rbt_node *node)
access next node of red–black binary search tree node postorder
a_rbt_node * a_rbt_post_tail(a_rbt const *root)
access tail node of red–black binary search tree postorder
void a_rbt_root(a_rbt *root)
initialize for red–black binary search tree root
Definition rbt.h:86
a_rbt_node * a_rbt_tail(a_rbt const *root)
access tail node of red–black binary search tree in-order
a_rbt_node * a_rbt_search(a_rbt const *root, void const *ctx, int(*cmp)(void const *, void const *))
search specified content from red–black binary search tree
#define a_uptr_c(x)
Definition a.h:580
#define a_uptr
Definition a.h:583
instance structure for red–black binary search tree node
Definition rbt.h:25
struct a_rbt_node * right
Definition rbt.h:27
uintptr_t parent_
Definition rbt.h:33
struct a_rbt_node * left
Definition rbt.h:26
instance structure for red–black binary search tree root
Definition rbt.h:78
struct a_rbt_node * node
root node
Definition rbt.h:79