#ifndef AVL_HEADER
#define AVL_HEADER
#include "gcc-attributes.h"
#ifndef AVL_MAX_HEIGHT
#define AVL_MAX_HEIGHT 92
#endif
typedef struct avl {
struct avl *avl_link[2];
signed char avl_balance;
} avl_t;
typedef struct avl_tree {
avl_t *root;
int (*compar)(void *a, void *b);
} avl_tree_t;
typedef struct avl_iterator {
avl_tree_t *tree;
avl_t *current;
avl_t *stack[AVL_MAX_HEIGHT];
unsigned height;
} avl_iterator;
* returns the added element a, or a pointer the
* element that is equal to a (as returned by t->compar())
* a is linked directly to the tree, so it has to
* be properly allocated by the caller.
*/
avl_t *avl_insert(avl_tree_t *t, avl_t *a) NEVERNULL WARNUNUSED;
* returns a pointer to the removed element
* or NULL if an element equal to a is not found
* (equal as returned by t->compar())
*/
avl_t *avl_remove(avl_tree_t *t, avl_t *a) WARNUNUSED;
* (equal as returned by t->compar())
* returns NULL is no element is equal to a
*/
avl_t *avl_search(const avl_tree_t *t, avl_t *a);
*/
void avl_init(avl_tree_t *t, int (*compar)(void *a, void *b));
*/
int avl_traverse(const avl_tree_t *t, int (*callback)(void *entry, void *data),
void *data);
*/
avl_t *avl_first(avl_iterator *i, avl_tree_t *t);
*/
avl_t *avl_next(avl_iterator *i);
*/
int avl_intersection(const avl_tree_t *needle, avl_tree_t *haystack);
#endif