uloop: fix signal unblocking
[project/libubox.git] / avl.h
diff --git a/avl.h b/avl.h
index 2591de3..c468597 100644 (file)
--- a/avl.h
+++ b/avl.h
@@ -45,7 +45,6 @@
 #include <stdbool.h>
 
 #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);
@@ -534,7 +545,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
 #define avl_remove_all_elements(tree, element, node_member, ptr) \
   for (element = avl_first_element(tree, element, node_member), \
        ptr = avl_next_element(element, node_member), \
-       list_init_head(&(tree)->list_head), \
+       INIT_LIST_HEAD(&(tree)->list_head), \
        (tree)->root = NULL; \
        (tree)->count > 0; \
        element = ptr, ptr = avl_next_element(ptr, node_member), (tree)->count--)