xf86-video-intel: src/intel_list.h

Chris Wilson ickle at kemper.freedesktop.org
Wed Feb 15 04:07:51 PST 2012


 src/intel_list.h |   26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

New commits:
commit 66cc9c69657ac2703f2c7fc3c2c50f06bf5daa99
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Feb 15 11:58:42 2012 +0000

    Be paranoid about the definition of container_of
    
    Replace any existing definition with a correct version, since there are
    broken container_of macros floating around the xorg includes.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_list.h b/src/intel_list.h
index 9187766..8e8c612 100644
--- a/src/intel_list.h
+++ b/src/intel_list.h
@@ -267,24 +267,6 @@ list_is_empty(struct list *head)
 }
 
 /**
- * Returns a pointer to the container of this list element.
- *
- * Example:
- * struct foo* f;
- * f = container_of(&foo->entry, struct foo, entry);
- * assert(f == foo);
- *
- * @param ptr Pointer to the struct list.
- * @param type Data type of the list element.
- * @param member Member name of the struct list field in the list element.
- * @return A pointer to the data struct containing the list head.
- */
-#ifndef container_of
-#define container_of(ptr, type, member) \
-	((type *)((char *)(ptr) - (char *) &((type *)0)->member))
-#endif
-
-/**
  * Alias of container_of
  */
 #define list_entry(ptr, type, member) \
@@ -397,14 +379,14 @@ static inline void list_move_tail(struct list *list, struct list *head)
 	list_add_tail(list, head);
 }
 
-#undef container_of
-#define container_of(ptr, type, member) \
-	((type *)((char *)(ptr) - (char *) &((type *)0)->member))
-
 #define list_last_entry(ptr, type, member) \
     list_entry((ptr)->prev, type, member)
 
 #endif
 
+#undef container_of
+#define container_of(ptr, type, member) \
+	((type *)((char *)(ptr) - (char *) &((type *)0)->member))
+
 #endif /* _INTEL_LIST_H_ */
 


More information about the xorg-commit mailing list