summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Stapp <mjs.ietf@gmail.com>2023-09-12 11:20:50 -0400
committerGitHub <noreply@github.com>2023-09-12 11:20:50 -0400
commitbf4e97c632538b6f79ff0a9ae738f2d12485c01c (patch)
tree4c7a80bed4db98050bbd0aa2e2207e2e5e581e48
parent7b8f81bcb6183a7d98ce25216e8b9280ee6ce994 (diff)
parent3ea3f34213f99990ff1108ed86393b35504df6e5 (diff)
Merge pull request #14365 from opensourcerouting/typesafe-const-declutter
Revert "lib: add a frr_each_const macro"
-rw-r--r--isisd/isis_flex_algo.c5
-rw-r--r--lib/typesafe.h8
2 files changed, 6 insertions, 7 deletions
diff --git a/isisd/isis_flex_algo.c b/isisd/isis_flex_algo.c
index ef30987b8e..fbe249ab5a 100644
--- a/isisd/isis_flex_algo.c
+++ b/isisd/isis_flex_algo.c
@@ -127,10 +127,7 @@ _isis_flex_algo_elected(int algorithm, const struct isis_area *area,
* Perform FAD comparison. First, compare the priority, and if they are
* the same, compare the sys-id.
*/
- /* clang-format off */
- frr_each_const(lspdb, &area->lspdb[ISIS_LEVEL1 - 1], lsp) {
- /* clang-format on */
-
+ frr_each (lspdb_const, &area->lspdb[ISIS_LEVEL1 - 1], lsp) {
if (!lsp->tlvs || !lsp->tlvs->router_cap)
continue;
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, \