From: Daniel Golle Date: Fri, 12 Nov 2021 20:04:29 +0000 (+0000) Subject: vlist: define vlist_for_each_element_safe X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=cce5e351278b307af7f69931971e3d4e060117d7;p=project%2Flibubox.git 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 --- diff --git a/vlist.h b/vlist.h index ff6b138..381fd97 100644 --- a/vlist.h +++ b/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)