]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include: [c.h] protect container_of
authormaximilian attems <max@stro.at>
Tue, 22 May 2012 14:20:42 +0000 (16:20 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 23 May 2012 08:31:07 +0000 (10:31 +0200)
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>
include/c.h

index b6d8cedafa2a0ce43f15a51c150c54523834988c..8c8db73324b590152b70c2e1cdd08fd67be7710e 100644 (file)
 #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