update avl implementation from packetbb
This commit is contained in:
parent
6370c3e636
commit
63cea8dcb7
2 changed files with 8 additions and 8 deletions
8
avl.c
8
avl.c
|
@ -111,7 +111,7 @@ avl_init(struct avl_tree *tree, avl_tree_comp comp, bool allow_dups, void *ptr)
|
||||||
* @param pointer to elemen, NULL if no fitting one was found
|
* @param pointer to elemen, NULL if no fitting one was found
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
__avl_find_element(struct avl_tree *tree, const void *key, size_t offset, enum avl_find_mode mode) {
|
__avl_find_element(const struct avl_tree *tree, const void *key, size_t offset, enum avl_find_mode mode) {
|
||||||
void *node = NULL;
|
void *node = NULL;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -136,7 +136,7 @@ __avl_find_element(struct avl_tree *tree, const void *key, size_t offset, enum a
|
||||||
* this key exists.
|
* this key exists.
|
||||||
*/
|
*/
|
||||||
struct avl_node *
|
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;
|
struct avl_node *node;
|
||||||
int diff;
|
int diff;
|
||||||
|
@ -158,7 +158,7 @@ avl_find(struct avl_tree *tree, const void *key)
|
||||||
* key less or equal specified key exists.
|
* key less or equal specified key exists.
|
||||||
*/
|
*/
|
||||||
struct avl_node *
|
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;
|
struct avl_node *node, *next;
|
||||||
int diff;
|
int diff;
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ avl_find_lessequal(struct avl_tree *tree, const void *key) {
|
||||||
* key greater or equal specified key exists.
|
* key greater or equal specified key exists.
|
||||||
*/
|
*/
|
||||||
struct avl_node *
|
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;
|
struct avl_node *node, *next;
|
||||||
int diff;
|
int diff;
|
||||||
|
|
||||||
|
|
8
avl.h
8
avl.h
|
@ -155,12 +155,12 @@ enum avl_find_mode {
|
||||||
};
|
};
|
||||||
|
|
||||||
void EXPORT(avl_init)(struct avl_tree *, avl_tree_comp, bool, void *);
|
void EXPORT(avl_init)(struct avl_tree *, avl_tree_comp, bool, void *);
|
||||||
struct avl_node *EXPORT(avl_find)(struct avl_tree *, const void *);
|
struct avl_node *EXPORT(avl_find)(const struct avl_tree *, const void *);
|
||||||
struct avl_node *EXPORT(avl_find_greaterequal)(struct avl_tree *tree, const void *key);
|
struct avl_node *EXPORT(avl_find_greaterequal)(const struct avl_tree *tree, const void *key);
|
||||||
struct avl_node *EXPORT(avl_find_lessequal)(struct avl_tree *tree, const void *key);
|
struct avl_node *EXPORT(avl_find_lessequal)(const struct avl_tree *tree, const void *key);
|
||||||
int EXPORT(avl_insert)(struct avl_tree *, struct avl_node *);
|
int EXPORT(avl_insert)(struct avl_tree *, struct avl_node *);
|
||||||
void EXPORT(avl_delete)(struct avl_tree *, struct avl_node *);
|
void EXPORT(avl_delete)(struct avl_tree *, struct avl_node *);
|
||||||
void *EXPORT(__avl_find_element)(struct avl_tree *tree, const void *key,
|
void *EXPORT(__avl_find_element)(const struct avl_tree *tree, const void *key,
|
||||||
size_t offset, enum avl_find_mode mode);
|
size_t offset, enum avl_find_mode mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue