40 assert(compare !=
NULL);
42 if (allocator ==
NULL)
65 assert(tree !=
NULL && item !=
NULL);
95 assert(tree !=
NULL && item !=
NULL);
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);
void avl_item_func(void *avl_item, void *avl_param)
void *(* libavl_malloc)(struct libavl_allocator *, size_t libavl_size)
struct avl_node * avl_node
unsigned long avl_generation
struct avl_node * avl_link[2]
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)
struct avl_node * avl_stack[AVL_MAX_HEIGHT]
int avl_comparison_func(const void *avl_a, const void *avl_b, void *avl_param)
struct avl_node * avl_root
#define avl_assert_delete
struct libavl_allocator avl_allocator_default
avl_comparison_func * avl_compare
struct libavl_allocator * avl_alloc
#define avl_assert_insert
void * avl_malloc(struct libavl_allocator *allocator, size_t size)
struct avl_table * avl_table