Add container_of function.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-05-03 10:49:30 +01:00
parent b4fbebcd09
commit 4290891c73
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,12 @@ typedef struct _E_Compositor E_Compositor;
# ifndef E_COMP_H
# define E_COMP_H
# define container_of(ptr, type, mbr) \
({ \
const __typeof__(((type *)0)->mbr) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, mbr)); \
})
struct _E_Compositor
{
struct