X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=avl.c;h=6019a9a40b8614237d2cba20d4f915380bf58459;hp=bde40b78cf5aefa1c63b4bcd504520f14c7157d4;hb=0001d8ab26694f5f546da7e8f9d0575b49671500;hpb=82ce342055ec8f7a0235d46f5332014eb3f69216 diff --git a/avl.c b/avl.c index bde40b7..6019a9a 100644 --- a/avl.c +++ b/avl.c @@ -103,32 +103,6 @@ avl_init(struct avl_tree *tree, avl_tree_comp comp, bool allow_dups, void *ptr) } /** - * Internal function to support returning the element from a avl tree query - * @param tree pointer to avl tree - * @param key pointer to key - * @param offset offset of node inside the embedded struct - * @param mode mode of lookup operation (less equal, equal or greater equal) - * @param pointer to elemen, NULL if no fitting one was found - */ -void * -__avl_find_element(struct avl_tree *tree, const void *key, size_t offset, enum avl_find_mode mode) { - void *node = NULL; - - switch (mode) { - case AVL_FIND_EQUAL: - node = avl_find(tree, key); - break; - case AVL_FIND_LESSEQUAL: - node = avl_find_lessequal(tree, key); - break; - case AVL_FIND_GREATEREQUAL: - node = avl_find_greaterequal(tree, key); - break; - } - return node == NULL ? NULL : (((char *)node) - offset); -} - -/** * Finds a node in an avl-tree with a certain key * @param tree pointer to avl-tree * @param key pointer to key @@ -136,7 +110,7 @@ __avl_find_element(struct avl_tree *tree, const void *key, size_t offset, enum a * this key exists. */ struct avl_node * -avl_find(struct avl_tree *tree, const void *key) +avl_find(const struct avl_tree *tree, const void *key) { struct avl_node *node; int diff; @@ -158,7 +132,7 @@ avl_find(struct avl_tree *tree, const void *key) * key less or equal specified key exists. */ struct avl_node * -avl_find_lessequal(struct avl_tree *tree, const void *key) { +avl_find_lessequal(const struct avl_tree *tree, const void *key) { struct avl_node *node, *next; int diff; @@ -200,7 +174,7 @@ avl_find_lessequal(struct avl_tree *tree, const void *key) { * key greater or equal specified key exists. */ struct avl_node * -avl_find_greaterequal(struct avl_tree *tree, const void *key) { +avl_find_greaterequal(const struct avl_tree *tree, const void *key) { struct avl_node *node, *next; int diff;