vlist: define vlist_for_each_element_safe
Yet another macro wrapper around the corresponding avl_* macro. This new macro makes it possible to iterate over vlists in ways which may have destructive consequences without being punished by segfault. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
c86a894ec6
commit
cce5e35127
1 changed files with 3 additions and 0 deletions
3
vlist.h
3
vlist.h
|
@ -72,6 +72,9 @@ void vlist_flush_all(struct vlist_tree *tree);
|
|||
#define vlist_for_each_element(tree, element, node_member) \
|
||||
avl_for_each_element(&(tree)->avl, element, node_member.avl)
|
||||
|
||||
#define vlist_for_each_element_safe(tree, element, node_member, ptr) \
|
||||
avl_for_each_element_safe(&(tree)->avl, element, node_member.avl, ptr)
|
||||
|
||||
#define vlist_for_each_element_reverse(tree, element, node_member) \
|
||||
avl_for_each_element_reverse(&(tree)->avl, element, node_member.avl)
|
||||
|
||||
|
|
Loading…
Reference in a new issue