Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cc74270 authored by Thierry Escande's avatar Thierry Escande Committed by Yong Yao
Browse files

Fix list_for_each_safe macro



The second macro parameter is named 'next' like listnode structure
'next' field. Since the precompiler will expand all 'next' occurrences
in the macro definition with what is passed by the caller, it is not
possible to call this macro with something else than 'next' as second
parameter.

This patch replaces the 'next' parameter with 'n' allowing use of a
next node not named 'next'.

Change-Id: I78c859caf8193f21fe0bedaeaa8342d6e89ad14b
Signed-off-by: default avatarThierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent a744f0a1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -44,10 +44,10 @@ struct listnode
#define list_for_each_reverse(node, list) \
    for (node = (list)->prev; node != (list); node = node->prev)

#define list_for_each_safe(node, next, list) \
    for (node = (list)->next, next = node->next; \
#define list_for_each_safe(node, n, list) \
    for (node = (list)->next, n = node->next; \
         node != (list); \
         node = next, next = node->next)
         node = n, n = node->next)

static inline void list_init(struct listnode *node)
{