Mesa (glsl2): glsl2: Use talloc_strdup when generating constructor temporary names
Ian Romanick
idr at kemper.freedesktop.org
Tue Jun 29 18:54:42 UTC 2010
Module: Mesa
Branch: glsl2
Commit: 4b6feb0398458a69259e3b77d7a8573b926f2039
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b6feb0398458a69259e3b77d7a8573b926f2039
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Mon Jun 28 13:22:55 2010 -0700
glsl2: Use talloc_strdup when generating constructor temporary names
---
src/glsl/ast_function.cpp | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index e23d789..f3074a3 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -481,7 +481,8 @@ emit_inline_vector_constructor(const glsl_type *type,
{
assert(!parameters->is_empty());
- ir_variable *var = new(ctx) ir_variable(type, strdup("vec_ctor"));
+ ir_variable *var = new(ctx) ir_variable(type,
+ talloc_strdup(ctx, "vec_ctor"));
instructions->push_tail(var);
/* There are two kinds of vector constructors.
@@ -592,7 +593,8 @@ emit_inline_matrix_constructor(const glsl_type *type,
{
assert(!parameters->is_empty());
- ir_variable *var = new(ctx) ir_variable(type, strdup("mat_ctor"));
+ ir_variable *var = new(ctx) ir_variable(type,
+ talloc_strdup(ctx, "mat_ctor"));
instructions->push_tail(var);
/* There are three kinds of matrix constructors.
@@ -614,8 +616,9 @@ emit_inline_matrix_constructor(const glsl_type *type,
/* Assign the scalar to the X component of a vec4, and fill the remaining
* components with zero.
*/
- ir_variable *rhs_var = new(ctx) ir_variable(glsl_type::vec4_type,
- strdup("mat_ctor_vec"));
+ ir_variable *rhs_var =
+ new(ctx) ir_variable(glsl_type::vec4_type,
+ talloc_strdup(ctx, "mat_ctor_vec"));
instructions->push_tail(rhs_var);
ir_constant_data zero;
@@ -727,8 +730,9 @@ emit_inline_matrix_constructor(const glsl_type *type,
* Since the parameter will be used in the RHS of multiple assignments,
* generate a temporary and copy the paramter there.
*/
- ir_variable *const rhs_var = new(ctx) ir_variable(first_param->type,
- strdup("mat_ctor_mat"));
+ ir_variable *const rhs_var =
+ new(ctx) ir_variable(first_param->type,
+ talloc_strdup(ctx, "mat_ctor_mat"));
instructions->push_tail(rhs_var);
ir_dereference *const rhs_var_ref =
@@ -792,8 +796,9 @@ emit_inline_matrix_constructor(const glsl_type *type,
/* Since the parameter might be used in the RHS of two assignments,
* generate a temporary and copy the paramter there.
*/
- ir_variable *rhs_var = new(ctx) ir_variable(rhs->type,
- strdup("mat_ctor_vec"));
+ ir_variable *rhs_var =
+ new(ctx) ir_variable(rhs->type,
+ talloc_strdup(ctx, "mat_ctor_vec"));
instructions->push_tail(rhs_var);
ir_dereference *rhs_var_ref =
More information about the mesa-commit
mailing list