summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2014-04-30 02:15:15 +0200
committerYong Yao <yong.yao@intel.com>2014-05-10 09:31:52 -0700
commit8cc74270405bbca5afa989b61c76b554c5b4f5a6 (patch)
tree564fab295d7b9344d79438d112050b5393a38213 /include
parenta744f0a11a4ff2e4a84a0af8e8e98e2e38babc32 (diff)
downloadsystem_core-8cc74270405bbca5afa989b61c76b554c5b4f5a6.tar.gz
system_core-8cc74270405bbca5afa989b61c76b554c5b4f5a6.tar.bz2
system_core-8cc74270405bbca5afa989b61c76b554c5b4f5a6.zip
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: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/cutils/list.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/cutils/list.h b/include/cutils/list.h
index 945729ab2..6a6891b83 100644
--- a/include/cutils/list.h
+++ b/include/cutils/list.h
@@ -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)
{