glsl: Replace uses of foreach_list_const.
authorMatt Turner <mattst88@gmail.com>
Wed, 25 Jun 2014 05:29:08 +0000 (22:29 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 1 Jul 2014 15:55:51 +0000 (08:55 -0700)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ir_clone.cpp
src/glsl/link_functions.cpp

index 86a620552aa77fe598510f9fbbbcbfaf5aca9bde..4b444d4683df0c2832f38215feb0bc4cbed6fd0c 100644 (file)
@@ -274,10 +274,7 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const
 {
    ir_function *copy = new(mem_ctx) ir_function(this->name);
 
-   foreach_list_const(node, &this->signatures) {
-      const ir_function_signature *const sig =
-        (const ir_function_signature *const) node;
-
+   foreach_in_list(const ir_function_signature, sig, &this->signatures) {
       ir_function_signature *sig_copy = sig->clone(mem_ctx, ht);
       copy->add_signature(sig_copy);
 
@@ -298,9 +295,7 @@ ir_function_signature::clone(void *mem_ctx, struct hash_table *ht) const
 
    /* Clone the instruction list.
     */
-   foreach_list_const(node, &this->body) {
-      const ir_instruction *const inst = (const ir_instruction *) node;
-
+   foreach_in_list(const ir_instruction, inst, &this->body) {
       ir_instruction *const inst_copy = inst->clone(mem_ctx, ht);
       copy->body.push_tail(inst_copy);
    }
@@ -320,9 +315,7 @@ ir_function_signature::clone_prototype(void *mem_ctx, struct hash_table *ht) con
 
    /* Clone the parameter list, but NOT the body.
     */
-   foreach_list_const(node, &this->parameters) {
-      const ir_variable *const param = (const ir_variable *) node;
-
+   foreach_in_list(const ir_variable, param, &this->parameters) {
       assert(const_cast<ir_variable *>(param)->as_variable() != NULL);
 
       ir_variable *const param_copy = param->clone(mem_ctx, ht);
@@ -426,8 +419,7 @@ clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in)
    struct hash_table *ht =
       hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
 
-   foreach_list_const(node, in) {
-      const ir_instruction *const original = (ir_instruction *) node;
+   foreach_in_list(const ir_instruction, original, in) {
       ir_instruction *copy = original->clone(mem_ctx, ht);
 
       out->push_tail(copy);
index 56f3f207ee8b2254a46865ec9e4b9d9cffd6e148..2ce9609b55d8b08637b75ec2c5273532e3ae9c42 100644 (file)
@@ -145,8 +145,7 @@ public:
       struct hash_table *ht = hash_table_ctor(0, hash_table_pointer_hash,
                                              hash_table_pointer_compare);
       exec_list formal_parameters;
-      foreach_list_const(node, &sig->parameters) {
-        const ir_instruction *const original = (ir_instruction *) node;
+      foreach_in_list(const ir_instruction, original, &sig->parameters) {
         assert(const_cast<ir_instruction *>(original)->as_variable());
 
         ir_instruction *copy = original->clone(linked, ht);
@@ -156,9 +155,7 @@ public:
       linked_sig->replace_parameters(&formal_parameters);
 
       if (sig->is_defined) {
-         foreach_list_const(node, &sig->body) {
-            const ir_instruction *const original = (ir_instruction *) node;
-
+         foreach_in_list(const ir_instruction, original, &sig->body) {
             ir_instruction *copy = original->clone(linked, ht);
             linked_sig->body.push_tail(copy);
          }