X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fsplay_tree.h;h=88d75164cb04fb42886faed2fa3141d062e97872;hb=70a1a5594af5d4e6a364186b42ba4e34c676009b;hp=e4af0c4ffc1653c6b902eb8fa3ecf7e83e08d37a;hpb=a22041922f160667573e9a5ae3f4195e1668906a;p=meshlink diff --git a/src/splay_tree.h b/src/splay_tree.h index e4af0c4f..88d75164 100644 --- a/src/splay_tree.h +++ b/src/splay_tree.h @@ -1,6 +1,6 @@ /* splay_tree.h -- header file for splay_tree.c - Copyright (C) 2004-2006 Guus Sliepen + Copyright (C) 2004-2012 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -104,4 +104,6 @@ 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); +#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