diff options
author | maximilian attems | 2012-05-22 16:20:42 +0200 |
---|---|---|
committer | Karel Zak | 2012-05-23 10:31:07 +0200 |
commit | ae278c88cf2fcfd4bd34fcf2c96d9b8a5b4dec29 (patch) | |
tree | 6bab1d288ee6cf91199f49da2ae9c192b2be1b3b /include/c.h | |
parent | hexdump: fix comparison of distinct pointer types (diff) | |
download | kernel-qcow2-util-linux-ae278c88cf2fcfd4bd34fcf2c96d9b8a5b4dec29.tar.gz kernel-qcow2-util-linux-ae278c88cf2fcfd4bd34fcf2c96d9b8a5b4dec29.tar.xz kernel-qcow2-util-linux-ae278c88cf2fcfd4bd34fcf2c96d9b8a5b4dec29.zip |
include: [c.h] protect container_of
fixes lots of warning noise:
../../../include/c.h:112:0: warning: "container_of" redefined [enabled
by default]
/usr/lib/klibc/include/stddef.h:52:0: note: this is the location of the
previous definition
Signed-off-by: maximilian attems <max@stro.at>
Diffstat (limited to 'include/c.h')
-rw-r--r-- | include/c.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h index b6d8cedaf..8c8db7332 100644 --- a/include/c.h +++ b/include/c.h @@ -109,9 +109,11 @@ #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) );}) +#endif #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME # ifdef HAVE___PROGNAME |