From dfb979d00dab951b32c8301daa084e91e5ef4846 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 24 Aug 2020 11:03:18 -0600 Subject: [PATCH] list: add LIF_LIST_FOREACH_REVERSE() --- libifupdown/list.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libifupdown/list.h b/libifupdown/list.h index 4a495b5..877354e 100644 --- a/libifupdown/list.h +++ b/libifupdown/list.h @@ -42,4 +42,7 @@ extern void lif_node_delete(struct lif_node *node, struct lif_list *list); #define LIF_LIST_FOREACH_SAFE(iter, iter_next, head) \ for ((iter) = (head), (iter_next) = (iter)->next; (iter) != NULL; (iter) = (iter_next), (iter_next) = (iter) != NULL ? (iter)->next : NULL) +#define LIF_LIST_FOREACH_REVERSE(iter, tail) \ + for ((iter) = (tail); (iter) != NULL; (iter) = (iter)->prev) + #endif