mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04: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
1 changed files with 5 additions and 0 deletions
|
|
@ -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 a new issue