From 06a7a6957865ec0aaf25487a4db52478b278731a Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 20 Apr 2021 16:24:26 -0400 Subject: [PATCH] Fix: rculist header: use parenthesis around macro parameters The coding style followed across liburcu is to use parenthesis around macro parameters when it would otherwise lead to unexpected results due to priority of operators. Fix rculist.h to follow this coding style. Signed-off-by: Mathieu Desnoyers Change-Id: Idcc85eef31bb8c11766e834554bfab8b6ed35864 --- include/urcu/rculist.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/urcu/rculist.h b/include/urcu/rculist.h index 1fd2df3..753135e 100644 --- a/include/urcu/rculist.h +++ b/include/urcu/rculist.h @@ -79,14 +79,13 @@ void cds_list_del_rcu(struct cds_list_head *elem) /* Iterate forward over the elements of the list. */ #define cds_list_for_each_rcu(pos, head) \ - for (pos = rcu_dereference((head)->next); pos != (head); \ - pos = rcu_dereference(pos->next)) - + for (pos = rcu_dereference((head)->next); (pos) != (head); \ + pos = rcu_dereference((pos)->next)) /* Iterate through elements of the list. */ #define cds_list_for_each_entry_rcu(pos, head, member) \ - for (pos = cds_list_entry(rcu_dereference((head)->next), __typeof__(*pos), member); \ - &pos->member != (head); \ - pos = cds_list_entry(rcu_dereference(pos->member.next), __typeof__(*pos), member)) + for (pos = cds_list_entry(rcu_dereference((head)->next), __typeof__(*(pos)), member); \ + &(pos)->member != (head); \ + pos = cds_list_entry(rcu_dereference((pos)->member.next), __typeof__(*(pos)), member)) #endif /* _URCU_RCULIST_H */ -- 2.34.1