Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/avl.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-03-21 02:06:42 +0400
committerFelix Fietkau <nbd@openwrt.org>2014-03-21 02:06:42 +0400
commit93b415c08d78ae5cb1bec077cd9e5ced9d4bb8a0 (patch)
treeb779c7cf8bf844e5269f35a8c48783c1b8656dcb /avl.c
parent97ec6311f2775ad410498617d815b2ee6cea30a2 (diff)
list_compat.h: remove
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'avl.c')
-rw-r--r--avl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/avl.c b/avl.c
index 0dfd903..8d0bf65 100644
--- a/avl.c
+++ b/avl.c
@@ -98,6 +98,11 @@ avl_init(struct avl_tree *tree, avl_tree_comp comp, bool allow_dups, void *ptr)
tree->cmp_ptr = ptr;
}
+static inline struct avl_node *avl_next(struct avl_node *node)
+{
+ return list_entry(node->list.next, struct avl_node, list);
+}
+
/**
* Finds a node in an avl-tree with a certain key
* @param tree pointer to avl-tree
@@ -236,7 +241,7 @@ avl_insert(struct avl_tree *tree, struct avl_node *new)
last = node;
while (!list_is_last(&last->list, &tree->list_head)) {
- next = list_next_element(last, list);
+ next = avl_next(last);
if (next->leader) {
break;
}
@@ -307,7 +312,7 @@ avl_delete(struct avl_tree *tree, struct avl_node *node)
if (node->leader) {
if (tree->allow_dups
&& !list_is_last(&node->list, &tree->list_head)
- && !(next = list_next_element(node, list))->leader) {
+ && !(next = avl_next(node))->leader) {
next->leader = true;
next->balance = node->balance;