X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsplay_tree.h;h=3ddf21727a6aec819951c94310e996997a39c607;hb=ae89a25695411149a7499189c9771762ad1f1726;hp=584887078d95e486d7cd6c63bdd4eac498944cf3;hpb=5e00a24e1f13fa70a6945831c409d873b7809d11;p=tinc diff --git a/src/splay_tree.h b/src/splay_tree.h index 58488707..3ddf2172 100644 --- a/src/splay_tree.h +++ b/src/splay_tree.h @@ -106,6 +106,12 @@ extern splay_node_t *splay_search_closest_greater_node(splay_tree_t *, const voi extern void splay_foreach(const splay_tree_t *, splay_action_t); extern void splay_foreach_node(const splay_tree_t *, splay_action_t); +/* + Iterates over a tree. + + CAUTION: while this construct supports deleting the current item, + it does *not* support deleting *other* nodes while iterating on the tree. + */ #define splay_each(type, item, tree) (type *item = (type *)1; item; item = NULL) for(splay_node_t *node = (tree)->head, *next; item = node ? node->data : NULL, next = node ? node->next : NULL, node; node = next) #endif