lib: add a frr_each_const macro

Add a frr_each_const macro equivalent to loop on const lists.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
Louis Scalbert 2022-09-13 14:03:23 +02:00
parent 46fb37cf67
commit 72eae2c3cb

View File

@ -20,6 +20,9 @@ extern "C" {
#define frr_each(prefix, head, item) \
for (item = prefix##_first(head); item; \
item = prefix##_next(head, item))
#define frr_each_const(prefix, head, item) \
for (item = prefix##_const_first(head); item; \
item = prefix##_const_next(head, item))
#define frr_each_safe(prefix, head, item) \
for (typeof(prefix##_next_safe(head, NULL)) prefix##_safe = \
prefix##_next_safe(head, \