summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/c.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/c.h b/include/c.h
index 8b2a2d19a..f1e329819 100644
--- a/include/c.h
+++ b/include/c.h
@@ -147,8 +147,8 @@
*/
#ifndef container_of
#define container_of(ptr, type, member) __extension__ ({ \
- void *__mptr = (void *)(ptr); \
- ((type *)(__mptr - offsetof(type, member))); })
+ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
#endif
#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME