mesa: Add and use foreach_list_typed_safe.
authorMatt Turner <mattst88@gmail.com>
Wed, 25 Jun 2014 17:51:30 +0000 (10:51 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 1 Jul 2014 15:55:51 +0000 (08:55 -0700)
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/list.h
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index 77e3aaf26e40927d64f7d50012b283a4d59ef938..b7221cb7c7f8eaeccf68f07daeee5c32638aa66c 100644 (file)
@@ -630,4 +630,13 @@ inline void exec_node::insert_before(exec_list *before)
        (__node)->__field.next != NULL;                                 \
        (__node) = exec_node_data(__type, (__node)->__field.next, __field))
 
+#define foreach_list_typed_safe(__type, __node, __field, __list)           \
+   for (__type * __node =                                                  \
+           exec_node_data(__type, (__list)->head, __field),                \
+               * __next =                                                  \
+           exec_node_data(__type, (__node)->__field.next, __field);        \
+        __next != NULL;                                                    \
+        __node = __next, __next =                                          \
+           exec_node_data(__type, (__next)->__field.next, __field))
+
 #endif /* LIST_CONTAINER_H */
index a45f1dd04048f7e39ff7938d7fcb6cd2f2e471bc..07e798264a4042b580cf2871bfb1111e75aa902b 100644 (file)
@@ -1506,9 +1506,7 @@ intel_miptree_all_slices_resolve(struct brw_context *brw,
 {
    bool did_resolve = false;
 
-   foreach_list_safe(node, &mt->hiz_map) {
-      struct intel_resolve_map *map = (struct intel_resolve_map *)node;
-
+   foreach_list_typed_safe(struct intel_resolve_map, map, link, &mt->hiz_map) {
       if (map->need != need)
         continue;