From: Kristian Høgsberg Date: Sat, 20 Oct 2012 03:05:37 +0000 (-0400) Subject: Define our own container_of as well X-Git-Tag: 1.0.0~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c31a4c025a819b7293fd984fabdbee39d81a645;p=platform%2Fupstream%2Fweston.git Define our own container_of as well Don't rely on libwayland-client/server to define this for us. --- diff --git a/clients/window.h b/clients/window.h index 4dd4c20..3d35396 100644 --- a/clients/window.h +++ b/clients/window.h @@ -30,6 +30,10 @@ #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) +#define container_of(ptr, type, member) ({ \ + const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + struct window; struct widget; struct display; diff --git a/src/compositor.h b/src/compositor.h index 19ab11e..3176bfd 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -39,6 +39,10 @@ #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) +#define container_of(ptr, type, member) ({ \ + const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + struct weston_transform { struct weston_matrix matrix; struct wl_list link;