40 assert(compare !=
NULL);
42 if (allocator ==
NULL)
65 assert(tree !=
NULL && item !=
NULL);
95 assert(tree !=
NULL && item !=
NULL);
100 for (q = z, p = y; p !=
NULL; q = p, p = p->
avl_link[dir]) {
106 if (p->avl_balance != 0)
108 da[k++] = dir = cmp > 0;
123 for (p = y, k = 0; p != n; p = p->
avl_link[da[k]], k++)
195 return p ==
NULL || *p == item ?
NULL : *p;
206 if (p ==
NULL || *p == item)
228 assert(tree !=
NULL && item !=
NULL);
232 for (cmp = -1; cmp != 0;
377 assert(trav !=
NULL);
415 assert(tree !=
NULL && trav !=
NULL);
440 assert(tree !=
NULL && trav !=
NULL);
526 assert(trav !=
NULL && src !=
NULL);
549 assert(trav !=
NULL);
595 assert(trav !=
NULL);
637 assert(trav !=
NULL);
659 assert(stack !=
NULL && height >= 0 &&
new !=
NULL);
661 for (; height > 2; height -= 2)
692 if (new->avl_count == 0)
696 y = (
struct avl_node *)&
new->avl_root;
702 new->avl_alloc->libavl_malloc(new->avl_alloc,
705 if (y != (
struct avl_node *)&new->avl_root) {
710 copy_error_recovery(stack, height,
new, destroy);
714 stack[height++] = (
struct avl_node *)x;
729 copy_error_recovery(stack, height,
new, destroy);
736 new->avl_alloc->libavl_malloc(new->avl_alloc,
739 copy_error_recovery(stack, height,
new, destroy);
765 assert(tree !=
NULL);
787 assert(allocator !=
NULL && size > 0);
794 assert(allocator !=
NULL && block !=
NULL);
809 assert(p !=
NULL && *p == item);
struct avl_table * avl_copy(const struct avl_table *org, avl_copy_func *copy, avl_item_func *destroy, struct libavl_allocator *allocator)
void avl_destroy(struct avl_table *tree, avl_item_func *destroy)
void avl_item_func(void *avl_item, void *avl_param)
void * avl_delete(struct avl_table *tree, const void *item)
void *(* libavl_malloc)(struct libavl_allocator *, size_t libavl_size)
void * avl_t_next(struct avl_traverser *trav)
struct avl_node * avl_node
void *() avl_assert_delete(struct avl_table *table, void *item)
unsigned long avl_generation
struct avl_table * avl_create(avl_comparison_func *compare, void *param, struct libavl_allocator *allocator)
void * avl_t_insert(struct avl_traverser *trav, struct avl_table *tree, void *item)
struct avl_node * avl_link[2]
void() avl_assert_insert(struct avl_table *table, void *item)
unsigned long avl_generation
void(* libavl_free)(struct libavl_allocator *, void *libavl_block)
void avl_free(struct libavl_allocator *allocator, void *block)
void * avl_copy_func(void *avl_item, void *avl_param)
void * avl_insert(struct avl_table *table, void *item)
void * avl_t_find(struct avl_traverser *trav, struct avl_table *tree, void *item)
void * avl_t_prev(struct avl_traverser *trav)
void * avl_find(const struct avl_table *tree, const void *item)
void * avl_t_cur(struct avl_traverser *trav)
struct avl_node * avl_stack[AVL_MAX_HEIGHT]
void * avl_t_replace(struct avl_traverser *trav, void *new)
int avl_comparison_func(const void *avl_a, const void *avl_b, void *avl_param)
void ** avl_probe(struct avl_table *tree, void *item)
struct avl_node * avl_root
struct libavl_allocator avl_allocator_default
void * avl_t_copy(struct avl_traverser *trav, const struct avl_traverser *src)
void * avl_replace(struct avl_table *table, void *item)
void * avl_t_first(struct avl_traverser *trav, struct avl_table *tree)
avl_comparison_func * avl_compare
struct libavl_allocator * avl_alloc
void * avl_malloc(struct libavl_allocator *allocator, size_t size)
void avl_t_init(struct avl_traverser *trav, struct avl_table *tree)
struct avl_table * avl_table
void * avl_t_last(struct avl_traverser *trav, struct avl_table *tree)