2005-04-08 15:01:17 +00:00
|
|
|
#ifndef STDDEF_H
|
|
|
|
#define STDDEF_H
|
|
|
|
|
|
|
|
/* for size_t */
|
2006-03-23 22:07:21 +00:00
|
|
|
#include <stdint.h>
|
2005-04-08 15:01:17 +00:00
|
|
|
|
|
|
|
#undef NULL
|
2006-03-23 22:07:21 +00:00
|
|
|
#define NULL ((void *)0)
|
2005-04-08 15:01:17 +00:00
|
|
|
|
|
|
|
#undef offsetof
|
|
|
|
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
|
|
|
|
2006-03-23 22:07:21 +00:00
|
|
|
#undef container_of
|
|
|
|
#define container_of(ptr, type, member) ({ \
|
|
|
|
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
|
|
|
(type *)( (char *)__mptr - offsetof(type,member) );})
|
|
|
|
|
2005-04-08 15:01:17 +00:00
|
|
|
#endif /* STDDEF_H */
|