[sheepdog] [PATCH 1/3] use offsetof in stddef.h
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Sat Oct 6 17:36:31 CEST 2012
Current code doesn't use pre-defiend compiler macro for offsetof
because __compiler_offsetof is not defined anywhere. This patch
includes stddef.h, which defines offsetof with __builtin_offsetof,
rather than redefining it.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
include/list.h | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/include/list.h b/include/list.h
index e1d645d..0c9d156 100644
--- a/include/list.h
+++ b/include/list.h
@@ -3,12 +3,7 @@
/* taken from linux kernel */
-#undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
-#else
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
+#include <stddef.h>
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
--
1.7.2.5
More information about the sheepdog
mailing list