[PATCH 3/4] include: Define LIST_ENTRY using the standard offsetof

Amine Khaldi amine.khaldi at reactos.org
Mon Dec 10 16:16:46 CST 2012


---
 include/wine/list.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/wine/list.h b/include/wine/list.h
index 9712603..b4d681f 100644
--- a/include/wine/list.h
+++ b/include/wine/list.h
@@ -21,6 +21,8 @@
 #ifndef __WINE_SERVER_LIST_H
 #define __WINE_SERVER_LIST_H
 
+#include <stddef.h>
+
 struct list
 {
     struct list *next;
@@ -227,6 +229,6 @@ static inline void list_move_head( struct list *dst,
struct list *src )
 /* get pointer to object containing list element */
 #undef LIST_ENTRY
 #define LIST_ENTRY(elem, type, field) \
-    ((type *)((char *)(elem) - (size_t)(&((type *)0)->field)))
+    ((type *)((char *)(elem) - offsetof(type, field)))
 
 #endif  /* __WINE_SERVER_LIST_H */
-- 
1.8.0




More information about the wine-patches mailing list