Skip to contentSkip to conversation

include: [c.h] protect container_of

PATCH Applied maximilian attems 2 participants 2 messages May 22, 2012 – May 23, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 include/c.h |    2 ++
 1 file changed, 2 insertions(+)
include/c.h +2 -0
index b6d8ced..8c8db73 100644
@@ -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
Signature · 1 line
1.7.10
maintainer Applied
#1 lore raw
Quoted 2 lines · maximilian attems
 include/c.h |    2 ++
 1 file changed, 2 insertions(+)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com