From: maximilian attems Date: Tue, 22 May 2012 14:20:42 +0000 (+0200) Subject: include: [c.h] protect container_of X-Git-Tag: v2.22-rc1~379 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae278c88cf2fcfd4bd34fcf2c96d9b8a5b4dec29;p=thirdparty%2Futil-linux.git 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 --- diff --git a/include/c.h b/include/c.h index b6d8cedafa..8c8db73324 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