diff options
| author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-12-13 22:01:34 +0100 |
|---|---|---|
| committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-12-14 09:16:20 -0500 |
| commit | 187eace6139754eae58a21303c808a270f70dc3f (patch) | |
| tree | 38c1d07b6cac4320455e3106bf7abab66cf134a8 | |
| parent | client: fix a strdup memory leak (diff) | |
| download | wayland-187eace6139754eae58a21303c808a270f70dc3f.tar wayland-187eace6139754eae58a21303c808a270f70dc3f.tar.gz wayland-187eace6139754eae58a21303c808a270f70dc3f.tar.bz2 wayland-187eace6139754eae58a21303c808a270f70dc3f.tar.lz wayland-187eace6139754eae58a21303c808a270f70dc3f.tar.xz wayland-187eace6139754eae58a21303c808a270f70dc3f.tar.zst wayland-187eace6139754eae58a21303c808a270f70dc3f.zip | |
Make wl_list_for_each* work for c++
| -rw-r--r-- | src/wayland-util.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wayland-util.h b/src/wayland-util.h index 953d51a..625a2d3 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -117,9 +117,15 @@ int wl_list_length(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); +#ifdef __GNUC__ #define __container_of(ptr, sample, member) \ - (void *)((char *)(ptr) - \ + (typeof(sample))((char *)(ptr) - \ ((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) \ for (pos = 0, pos = __container_of((head)->next, pos, member); \ |
