Fix potentially undefined behavior

Really this time.

http://llvm.org/bugs/show_bug.cgi?id=8670
dev
Joel Teichroeb 14 years ago committed by Kristian Høgsberg
parent 55973f2f5a
commit 675c77c36a
  1. 7
      wayland/wayland-util.h

@ -94,19 +94,20 @@ int wl_list_empty(struct wl_list *list);
((char *)&(sample)->member - (char *)(sample)))
#define wl_list_for_each(pos, head, member) \
for (pos = __container_of((head)->next, pos, member); \
for (pos = 0, pos = __container_of((head)->next, pos, member); \
&pos->member != (head); \
pos = __container_of(pos->member.next, pos, member))
#define wl_list_for_each_safe(pos, tmp, head, member) \
for (pos = __container_of((head)->next, pos, member), \
for (pos = 0, tmp = 0, \
pos = __container_of((head)->next, pos, member), \
tmp = __container_of((pos)->member.next, tmp, member); \
&pos->member != (head); \
pos = tmp, \
tmp = __container_of(pos->member.next, tmp, member))
#define wl_list_for_each_reverse(pos, head, member) \
for (pos = __container_of((head)->prev, pos, member); \
for (pos = 0, pos = __container_of((head)->prev, pos, member); \
&pos->member != (head); \
pos = __container_of(pos->member.prev, pos, member))

Loading…
Cancel
Save