1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

Add macro RB_FOREACH_SAFE(), which accepts an additional argument

specifying a temporary tree node pointer. It may be used in a
similar way to the *_SAFE() macros in <sys/queue.h>.
This commit is contained in:
Bruce M Simpson 2008-12-24 19:57:22 +00:00
parent 138f7e4b30
commit c494cd1e77
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186479

View File

@ -737,6 +737,11 @@ name##_RB_MINMAX(struct name *head, int val) \
(x) != NULL; \
(x) = name##_RB_NEXT(x))
#define RB_FOREACH_SAFE(x, name, head, y) \
for ((x) = RB_MIN(name, head); \
(x) != NULL && ((y) = name##_RB_NEXT(x)); \
(x) = (y))
#define RB_FOREACH_REVERSE(x, name, head) \
for ((x) = RB_MAX(name, head); \
(x) != NULL; \