• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef STDDEF_H
2 #define STDDEF_H
3 
4 FILE_LICENCE ( GPL2_ONLY );
5 
6 /* for size_t */
7 #include <stdint.h>
8 
9 #undef NULL
10 #define NULL ((void *)0)
11 
12 #undef offsetof
13 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
14 
15 #undef container_of
16 #define container_of(ptr, type, member) ({                      \
17 	const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
18 	(type *)( (char *)__mptr - offsetof(type,member) );})
19 
20 /* __WCHAR_TYPE__ is defined by gcc and will change if -fshort-wchar is used */
21 #ifndef __WCHAR_TYPE__
22 #define __WCHAR_TYPE__ long int
23 #endif
24 typedef __WCHAR_TYPE__ wchar_t;
25 
26 #endif /* STDDEF_H */
27