glsl: Eliminate reduce/reduce conflicts in glsl grammar
[mesa.git] / src / glsl / loop_controls.cpp
index 2ef3d305254d0985d5ccb51c5a6b2f41e74b5268..9eaa50f22d45ca8d51bdcee48896387b2a9ae1e5 100644 (file)
@@ -85,7 +85,10 @@ int
 calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
                     enum ir_expression_operation op)
 {
-   void *mem_ctx = talloc_init("%s", __func__);
+   if (from == NULL || to == NULL || increment == NULL)
+      return -1;
+
+   void *mem_ctx = ralloc_context(NULL);
 
    ir_expression *const sub =
       new(mem_ctx) ir_expression(ir_binop_sub, from->type, to, from);
@@ -144,7 +147,7 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
       }
    }
 
-   talloc_free(mem_ctx);
+   ralloc_free(mem_ctx);
    return (valid_loop) ? iter_value : -1;
 }