From: Mathieu Desnoyers Date: Tue, 20 Apr 2021 20:24:26 +0000 (-0400) Subject: Fix: rculist header: use parenthesis around macro parameters X-Git-Tag: v0.13.0~8 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5e1b7c840a2b21b8442b322cedbb70a790e49520;p=urcu.git 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 --- 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 */