39 assert(compare !=
NULL);
41 if (allocator ==
NULL)
63 assert(tree !=
NULL && item !=
NULL);
99 assert(tree !=
NULL && item !=
NULL);
104 for (q = z, p = y;; q = p, p = p->
tavl_link[dir]) {
108 return &p->tavl_data;
110 if (p->tavl_balance != 0)
112 da[k++] = dir = cmp > 0;
142 for (p = y, k = 0; p !=
n; p = p->
tavl_link[da[k]], k++)
245 return p ==
NULL || *p == item ?
NULL : *p;
256 if (p ==
NULL || *p == item)
309 assert(tree !=
NULL && item !=
NULL);
315 for (cmp = -1; cmp != 0;
403 q = find_parent(tree, y);
546 assert(tree !=
NULL && trav !=
NULL);
564 assert(tree !=
NULL && trav !=
NULL);
645 assert(trav !=
NULL && src !=
NULL);
658 assert(trav !=
NULL);
679 assert(trav !=
NULL);
698 assert(trav !=
NULL);
732 new->tavl_link[dir] = dst->
tavl_link[dir];
734 new->tavl_link[!dir] = dst;
744 if (new->tavl_data ==
NULL)
790 if (new->tavl_count == 0)
803 if (!copy_node(
new, q, 0, p->
tavl_link[0], copy)) {
804 copy_error_recovery(rq.
tavl_link[0],
new, destroy);
828 if (!copy_node(
new, q, 1, p->
tavl_link[1], copy)) {
829 copy_error_recovery(rq.
tavl_link[0],
new, destroy);
867 assert(allocator !=
NULL && size > 0);
874 assert(allocator !=
NULL && block !=
NULL);
889 assert(p !=
NULL && *p == item);
struct tavl_node * tavl_node
void * tavl_replace(struct tavl_table *table, void *item)
void tavl_item_func(void *tavl_item, void *tavl_param)
void * tavl_t_next(struct tavl_traverser *trav)
void *(* libavl_malloc)(struct libavl_allocator *, size_t libavl_size)
void * tavl_t_prev(struct tavl_traverser *trav)
void * tavl_t_last(struct tavl_traverser *trav, struct tavl_table *tree)
void * tavl_t_copy(struct tavl_traverser *trav, const struct tavl_traverser *src)
void * tavl_copy_func(void *tavl_item, void *tavl_param)
void ** tavl_probe(struct tavl_table *tree, void *item)
struct tavl_table * tavl_copy(const struct tavl_table *org, tavl_copy_func *copy, tavl_item_func *destroy, struct libavl_allocator *allocator)
void(* libavl_free)(struct libavl_allocator *, void *libavl_block)
void * tavl_delete(struct tavl_table *tree, const void *item)
void * tavl_t_cur(struct tavl_traverser *trav)
void * tavl_malloc(struct libavl_allocator *allocator, size_t size)
struct tavl_table * tavl_create(tavl_comparison_func *compare, void *param, struct libavl_allocator *allocator)
struct tavl_node * tavl_link[2]
void * tavl_t_first(struct tavl_traverser *trav, struct tavl_table *tree)
void tavl_t_init(struct tavl_traverser *trav, struct tavl_table *tree)
void * tavl_insert(struct tavl_table *table, void *item)
int tavl_comparison_func(const void *tavl_a, const void *tavl_b, void *tavl_param)
void tavl_free(struct libavl_allocator *allocator, void *block)
void * tavl_find(const struct tavl_table *tree, const void *item)
struct tavl_node * tavl_root
void * tavl_t_find(struct tavl_traverser *trav, struct tavl_table *tree, void *item)
struct libavl_allocator tavl_allocator_default
void * tavl_t_replace(struct tavl_traverser *trav, void *new)
void * tavl_t_insert(struct tavl_traverser *trav, struct tavl_table *tree, void *item)
tavl_comparison_func * tavl_compare
void() tavl_assert_insert(struct tavl_table *table, void *item)
void *() tavl_assert_delete(struct tavl_table *table, void *item)
struct tavl_table * tavl_table
void tavl_destroy(struct tavl_table *tree, tavl_item_func *destroy)
struct libavl_allocator * tavl_alloc
unsigned char tavl_tag[2]