software/libbase: stddef.h
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 25 May 2012 20:30:17 +0000 (22:30 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 25 May 2012 20:30:17 +0000 (22:30 +0200)
software/include/base/stddef.h [new file with mode: 0644]
software/include/base/stdlib.h

diff --git a/software/include/base/stddef.h b/software/include/base/stddef.h
new file mode 100644 (file)
index 0000000..331f39e
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __STDDEF_H
+#define __STDDEF_H
+
+#define NULL ((void *)0)
+
+typedef unsigned long size_t;
+typedef long ptrdiff_t;
+
+#define offsetof(s,m) (size_t)&(((s *)0)->m)
+
+#endif /* __STDDEF_H */
index cea677d50c97f0fee6deeee85854c426b99f7a4a..7d2e250885a3cdc52a41d0344baef1a3e30b14e6 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __STDLIB_H
 #define __STDLIB_H
 
+#include <stddef.h>
+
 #define PRINTF_ZEROPAD 1               /* pad with zero */
 #define PRINTF_SIGN    2               /* unsigned/signed long */
 #define PRINTF_PLUS    4               /* show plus */
 #define PRINTF_SPECIAL 32              /* 0x */
 #define PRINTF_LARGE   64              /* use 'ABCDEF' instead of 'abcdef' */
 
-typedef unsigned long size_t;
-typedef long ptrdiff_t;
-
-#define NULL ((void *)0)
-
 #define likely(x) x
 #define unlikely(x) x