From 4fad63b82746ea571edc2ec1100ad3208cf5af08 Mon Sep 17 00:00:00 2001 From: Eric Hopper Date: Fri, 29 Jun 2007 01:30:09 -0700 Subject: Use offsetof macro instead of unportable pointer arithmetic. --- cbtcommon/list.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 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 */ -- cgit v1.2.1