summaryrefslogtreecommitdiff
path: root/lib/typesafe.h
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2022-09-13 14:03:23 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2023-04-18 10:13:59 +0200
commit72eae2c3cb771b7010f3f07b6c638e9ae078bbdf (patch)
tree55d338df6db9d2f8d7e84f09e772ed4e3f068440 /lib/typesafe.h
parent46fb37cf6774e910692f254e870451b2960197f2 (diff)
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>
Diffstat (limited to 'lib/typesafe.h')
-rw-r--r--lib/typesafe.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/typesafe.h b/lib/typesafe.h
index 1e3f932565..3292b6ec8b 100644
--- a/lib/typesafe.h
+++ b/lib/typesafe.h
@@ -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, \