Amine Khaldi : include: Define LIST_ENTRY using the standard offsetof.

Alexandre Julliard julliard at winehq.org
Tue Dec 11 14:41:15 CST 2012


Module: wine
Branch: master
Commit: 9b4e92a6f153ed4139c8e8c54b6bb0213a66bfc7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9b4e92a6f153ed4139c8e8c54b6bb0213a66bfc7

Author: Amine Khaldi <amine.khaldi at reactos.org>
Date:   Mon Dec 10 23:16:46 2012 +0100

include: Define LIST_ENTRY using the standard offsetof.

---

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

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 */




More information about the wine-cvs mailing list