diff options
author | Dave Airlie <[email protected]> | 2010-07-02 15:27:17 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-07-02 15:27:17 +1000 |
commit | 8556b77c56f3f1f0e75ce46d6b5c0d84c7b4eabd (patch) | |
tree | 9157c30056afe4b8b341c06de16a1715218682f0 /src/gallium/auxiliary/util | |
parent | 44732103b2b7a8765299e586fb3b9bf91e32f6d4 (diff) |
r600: use gallium list macros instead of making our own.
before this change, r600 glxinfo segfaulted in the list code, and I wasn't
debugging another linked list implementation, its 2010 after all.
So add the two missing list macros to the gallium header from X.org list header file (after fixing them), then port all r600 lists to the new header.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_double_list.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_double_list.h b/src/gallium/auxiliary/util/u_double_list.h index 53bb1342ddc..42adb1f0699 100644 --- a/src/gallium/auxiliary/util/u_double_list.h +++ b/src/gallium/auxiliary/util/u_double_list.h @@ -98,5 +98,20 @@ struct list_head #define LIST_IS_EMPTY(__list) \ ((__list)->next == (__list)) - +#ifndef container_of +#define container_of(ptr, sample, member) \ + (void *)((char *)(ptr) \ + - ((char *)&(sample)->member - (char *)(sample))) +#endif + +#define LIST_FOR_EACH_ENTRY(pos, head, member) \ + for (pos = container_of((head)->next, pos, member); \ + &pos->member != (head); \ + pos = container_of(pos->member.next, pos, member)) + +#define LIST_FOR_EACH_ENTRY_SAFE(pos, storage, head, member) \ + for (pos = container_of((head)->next, pos, member), \ + storage = container_of(pos->member.next, pos, member); \ + &pos->member != (head); \ + pos = storage, storage = container_of(storage->member.next, storage, member)) #endif /*_U_DOUBLE_LIST_H_*/ |