summaryrefslogtreecommitdiff
path: root/lib/typesafe.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2023-09-07 17:11:52 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2023-09-07 17:11:52 +0200
commit3ea3f34213f99990ff1108ed86393b35504df6e5 (patch)
treee384cea2b87b59f9f75ecf87867fbd803bdd17d2 /lib/typesafe.h
parent36bd815ba77564398e1398ad7f071bafa34e93be (diff)
lib: add inline comment about _const iteration
This is noted in doc/developer/lists.rst, but judging by the previous commit that's not where people look for this thing. Let's try a comment in the header file. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/typesafe.h')
-rw-r--r--lib/typesafe.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/typesafe.h b/lib/typesafe.h
index d2587160ea..a84298b062 100644
--- a/lib/typesafe.h
+++ b/lib/typesafe.h
@@ -17,6 +17,11 @@ 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))