From 72eae2c3cb771b7010f3f07b6c638e9ae078bbdf Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 13 Sep 2022 14:03:23 +0200 Subject: [PATCH] lib: add a frr_each_const macro Add a frr_each_const macro equivalent to loop on const lists. Signed-off-by: Louis Scalbert --- lib/typesafe.h | 3 +++ 1 file changed, 3 insertions(+) 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, \