diff options
author | Eric Hopper <hopper@omnifarious.org> | 2007-06-29 01:30:09 -0700 |
---|---|---|
committer | Yann Dirson <ydirson@altern.org> | 2008-03-31 15:46:15 +0200 |
commit | 4fad63b82746ea571edc2ec1100ad3208cf5af08 (patch) | |
tree | a7490c3470f66fb59e39f69c625179644aab6ea3 | |
parent | 99dc818a30edecfa217916010e1f6f5c1a0dda64 (diff) | |
download | cvsps-4fad63b82746ea571edc2ec1100ad3208cf5af08.tar.gz |
Use offsetof macro instead of unportable pointer arithmetic.
-rw-r--r-- | cbtcommon/list.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cbtcommon/list.h b/cbtcommon/list.h index 4ee245d..cf4b3ed 100644 --- a/cbtcommon/list.h +++ b/cbtcommon/list.h @@ -23,6 +23,7 @@ */ #include "inline.h" +#include <stddef.h> struct list_head { struct list_head *next, *prev; @@ -107,6 +108,6 @@ static INLINE void list_splice(struct list_head *list, struct list_head *head) } #define list_entry(ptr, type, member) \ - ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + ((type *)((char *)(ptr)-offsetof(type, member))) #endif /* _COMMON_LIST_H */ |