Newer versions of clang complain about "member access within null
pointer" when using the construct:
(unsigned long)(intptr_t)(&((type *)0)->member)
So use offsetof(type, member) instead.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
#include <stdint.h>
#endif
#endif
+#include <stddef.h>
#ifdef __GNUC__
#define _INLINE_ static __inline__
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(intptr_t)(&((type *)0)->member)))
+ ((type *)((char *)(ptr) - offsetof(type, member)))
/**
* list_for_each - iterate over elements in a list