Skip to content

Commit

Permalink
lib: add a frr_each_const macro
Browse files Browse the repository at this point in the history
Add a frr_each_const macro equivalent to loop on const lists.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
  • Loading branch information
louis-6wind committed Apr 18, 2023
1 parent 46fb37c commit 72eae2c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/typesafe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down

0 comments on commit 72eae2c

Please sign in to comment.