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:
parent
138f7e4b30
commit
c494cd1e77
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186479
@ -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; \
|
||||
|
Loading…
Reference in New Issue
Block a user