diff options
Diffstat (limited to 'lib/typesafe.h')
| -rw-r--r-- | lib/typesafe.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/typesafe.h b/lib/typesafe.h index 8eb59c33b7..a84298b062 100644 --- a/lib/typesafe.h +++ b/lib/typesafe.h @@ -17,12 +17,14 @@ extern "C" { /* generic macros for all list-like types */ +/* to iterate using the const variants of the functions, append "_const" to + * the name of the container, e.g. "frr_each (my_list, head, item)" becomes + * "frr_each (my_list_const, head, item)" + */ + #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, \ |
