mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-04 13:29:51 -05:00
Make wl_list_for_each* work for c++
This commit is contained in:
parent
e631ab6cde
commit
187eace613
1 changed files with 7 additions and 1 deletions
|
|
@ -117,9 +117,15 @@ int wl_list_length(struct wl_list *list);
|
||||||
int wl_list_empty(struct wl_list *list);
|
int wl_list_empty(struct wl_list *list);
|
||||||
void wl_list_insert_list(struct wl_list *list, struct wl_list *other);
|
void wl_list_insert_list(struct wl_list *list, struct wl_list *other);
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
#define __container_of(ptr, sample, member) \
|
#define __container_of(ptr, sample, member) \
|
||||||
(void *)((char *)(ptr) - \
|
(typeof(sample))((char *)(ptr) - \
|
||||||
((char *)&(sample)->member - (char *)(sample)))
|
((char *)&(sample)->member - (char *)(sample)))
|
||||||
|
#else
|
||||||
|
#define __container_of(ptr, sample, member) \
|
||||||
|
(void *)((char *)(ptr) - \
|
||||||
|
((char *)&(sample)->member - (char *)(sample)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define wl_list_for_each(pos, head, member) \
|
#define wl_list_for_each(pos, head, member) \
|
||||||
for (pos = 0, pos = __container_of((head)->next, pos, member); \
|
for (pos = 0, pos = __container_of((head)->next, pos, member); \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue