blob: 11d126501a45ef98e5b00223b67802ded449d61e [file] [log] [blame]
From f06b90cdc478124eba45b3be4f3630e8a729c51b Mon Sep 17 00:00:00 2001
From: ligd <liguiding1@xiaomi.com>
Date: Tue, 25 Jul 2023 14:25:58 +0800
Subject: [PATCH] libmetal: add metal_list_for_each_safe() support
Signed-off-by: ligd <liguiding1@xiaomi.com>
---
lib/list.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/list.h libmetal/lib/list.h
index eb0e7b3..3e8d17f 100644
--- a/lib/list.h
+++ libmetal/lib/list.h
@@ -98,6 +98,10 @@ static inline struct metal_list *metal_list_first(struct metal_list *list)
(node) != (list); \
(node) = (node)->next)
+#define metal_list_for_each_safe(list, node, temp) \
+ for(node = (list)->next, temp = node->next; \
+ node != (list); node = temp, temp = node->next)
+
static inline bool metal_list_find_node(struct metal_list *list,
struct metal_list *node)
{
--
2.25.1