mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-01 22:58:40 -04:00
Add wl_list_for_each() and simplify some loops
This commit is contained in:
parent
d923e9d93b
commit
a5db589efa
4 changed files with 25 additions and 114 deletions
|
|
@ -82,6 +82,15 @@ void wl_list_remove(struct wl_list *elm);
|
|||
int wl_list_length(struct wl_list *list);
|
||||
int wl_list_empty(struct wl_list *list);
|
||||
|
||||
#define __container_of(ptr, sample, member) \
|
||||
(void *)((char *)(ptr) - \
|
||||
((char *)&(sample)->member - (char *)(sample)))
|
||||
|
||||
#define wl_list_for_each(pos, head, member) \
|
||||
for (pos = __container_of((head)->next, pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = __container_of(pos->member.next, pos, member))
|
||||
|
||||
struct wl_array {
|
||||
uint32_t size;
|
||||
uint32_t alloc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue