diff options
Diffstat (limited to 'osdep.h')
-rw-r--r-- | osdep.h | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -23,9 +23,14 @@ #define unlikely(x) __builtin_expect(!!(x), 0) #endif +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) +#endif +#ifndef container_of #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) + const typeof(((type *) 0)->member) *__mptr = (ptr); \ + (type *) ((char *) __mptr - offsetof(type, member));}) +#endif #ifndef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) |