aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir.cpp
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-10-07 22:26:58 +0200
committerMarek Olšák <[email protected]>2016-10-31 11:53:38 +0100
commit7a2387c3e0e91f649676661c607d71f3b4eba5d5 (patch)
tree7a83566e0a421b9850394f307bc8b4fa988717d4 /src/compiler/glsl/ir.cpp
parent21e11b528269153b2042f1ca22830698de07aadb (diff)
glsl: use a non-malloc'd storage for short ir_variable names
Tested-by: Edmondo Tommasina <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir.cpp')
-rw-r--r--src/compiler/glsl/ir.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index c5943e5fcaa..8e4b382ebd3 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1523,6 +1523,10 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
if (mode == ir_var_temporary
&& (name == NULL || name == ir_variable::tmp_name)) {
this->name = ir_variable::tmp_name;
+ } else if (name == NULL ||
+ strlen(name) < ARRAY_SIZE(this->name_storage)) {
+ strcpy(this->name_storage, name ? name : "");
+ this->name = this->name_storage;
} else {
this->name = ralloc_strdup(this, name);
}