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:
Daniel Golle 2021-11-12 20:04:29 +00:00
parent c86a894ec6
commit cce5e35127
No known key found for this signature in database
GPG key ID: 5A8F39C31C3217CA

View file

@ -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)