diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-02-15 11:58:42 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-02-15 11:58:42 +0000 |
commit | 66cc9c69657ac2703f2c7fc3c2c50f06bf5daa99 (patch) | |
tree | 2fc923d1ba26fba57fdf9db56df9ee74959c3bb9 | |
parent | c0376b7f7b083ab2e87edc36e56fd8eb99c3cd05 (diff) |
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@chris-wilson.co.uk>
-rw-r--r-- | src/intel_list.h | 26 |
1 files changed, 4 insertions, 22 deletions
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 @@ -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_ */ |