Fix: rculist header: use parenthesis around macro parameters
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 20 Apr 2021 20:24:26 +0000 (16:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Apr 2021 12:33:00 +0000 (08:33 -0400)
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 <mathieu.desnoyers@efficios.com>
Change-Id: Idcc85eef31bb8c11766e834554bfab8b6ed35864

include/urcu/rculist.h

index 1fd2df388f57cefc0ea19fa02a0c8c0b627847e8..753135e2cd98ab4981a7f0d73b2bc9ac72811a18 100644 (file)
@@ -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 */
This page took 0.035086 seconds and 4 git commands to generate.