avl: fix type handling in container_of uses
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
parent
7c11f6e913
commit
cdb9f71971
1 changed files with 4 additions and 4 deletions
8
avl.h
8
avl.h
|
@ -267,7 +267,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
|
||||||
* (automatically converted to type 'element')
|
* (automatically converted to type 'element')
|
||||||
*/
|
*/
|
||||||
#define avl_first_element(tree, element, node_member) \
|
#define avl_first_element(tree, element, node_member) \
|
||||||
container_of((tree)->list_head.next, typeof(*(element)), node_member)
|
container_of((tree)->list_head.next, typeof(*(element)), node_member.list)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tree pointer to tree
|
* @param tree pointer to tree
|
||||||
|
@ -279,7 +279,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
|
||||||
* (automatically converted to type 'element')
|
* (automatically converted to type 'element')
|
||||||
*/
|
*/
|
||||||
#define avl_last_element(tree, element, node_member) \
|
#define avl_last_element(tree, element, node_member) \
|
||||||
container_of((tree)->list_head.prev, typeof(*(element)), node_member)
|
container_of((tree)->list_head.prev, typeof(*(element)), node_member.list)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function must not be called for the last element of
|
* This function must not be called for the last element of
|
||||||
|
@ -292,7 +292,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
|
||||||
* (automatically converted to type 'element')
|
* (automatically converted to type 'element')
|
||||||
*/
|
*/
|
||||||
#define avl_next_element(element, node_member) \
|
#define avl_next_element(element, node_member) \
|
||||||
container_of((&(element)->node_member.list)->next, typeof(*(element)), node_member)
|
container_of((&(element)->node_member.list)->next, typeof(*(element)), node_member.list)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function must not be called for the first element of
|
* This function must not be called for the first element of
|
||||||
|
@ -305,7 +305,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
|
||||||
* (automatically converted to type 'element')
|
* (automatically converted to type 'element')
|
||||||
*/
|
*/
|
||||||
#define avl_prev_element(element, node_member) \
|
#define avl_prev_element(element, node_member) \
|
||||||
container_of((&(element)->node_member.list)->prev, typeof(*(element)), node_member)
|
container_of((&(element)->node_member.list)->prev, typeof(*(element)), node_member.list)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loop over a block of elements of a tree, used similar to a for() command.
|
* Loop over a block of elements of a tree, used similar to a for() command.
|
||||||
|
|
Loading…
Reference in a new issue