X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=avl.h;h=c46859723ff1418d05ba2bab52ee5796da753f1b;hp=8323246e14cd2acd3ad7513fcb310036f3c81e68;hb=fd57eea9f37e447814afbf934db626288aac23c4;hpb=d1e59653fa6c7599320155ca7acb92f457f60fa6 diff --git a/avl.h b/avl.h index 8323246..c468597 100644 --- a/avl.h +++ b/avl.h @@ -45,7 +45,6 @@ #include #include "list.h" -#include "list_compat.h" /* Support for OLSR.org linker symbol export */ #define EXPORT(sym) sym @@ -154,6 +153,18 @@ enum avl_find_mode { AVL_FIND_GREATEREQUAL }; +#define AVL_TREE_INIT(_name, _comp, _allow_dups, _cmp_ptr) \ + { \ + .list_head = LIST_HEAD_INIT(_name.list_head), \ + .comp = _comp, \ + .allow_dups = _allow_dups, \ + .cmp_ptr = _cmp_ptr \ + } + +#define AVL_TREE(_name, _comp, _allow_dups, _cmp_ptr) \ + struct avl_tree _name = \ + AVL_TREE_INIT(_name, _comp, _allow_dups, _cmp_ptr) + void EXPORT(avl_init)(struct avl_tree *, avl_tree_comp, bool, void *); struct avl_node *EXPORT(avl_find)(const struct avl_tree *, const void *); struct avl_node *EXPORT(avl_find_greaterequal)(const struct avl_tree *tree, const void *key);