From 66cc9c69657ac2703f2c7fc3c2c50f06bf5daa99 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 15 Feb 2012 11:58:42 +0000 Subject: 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 --- src/intel_list.h | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'src/intel_list.h') diff --git a/src/intel_list.h b/src/intel_list.h index 91877665..8e8c612e 100644 --- a/src/intel_list.h +++ b/src/intel_list.h @@ -266,24 +266,6 @@ list_is_empty(struct list *head) return head->next == 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 */ @@ -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_ */ -- cgit v1.2.3