Mesa (glsl2): glsl2: Make function names and variable names be children of the node.

Eric Anholt anholt at kemper.freedesktop.org
Wed Jun 30 12:01:56 PDT 2010


Module: Mesa
Branch: glsl2
Commit: 0eda9ae0a6bcd6a7e014df046c87fac5caee0e9e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0eda9ae0a6bcd6a7e014df046c87fac5caee0e9e

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jun 30 11:51:54 2010 -0700

glsl2: Make function names and variable names be children of the node.

This avoids losing their memory when the parser state is freed.

---

 src/glsl/ir.cpp |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 4eb0e9e..60ee36d 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -733,7 +733,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name)
      mode(ir_var_auto), interpolation(ir_var_smooth), array_lvalue(false)
 {
    this->type = type;
-   this->name = name;
+   this->name = talloc_strdup(this, name);
    this->location = -1;
    this->warn_extension = NULL;
    this->constant_value = NULL;
@@ -820,9 +820,8 @@ ir_function_signature::replace_parameters(exec_list *new_params)
 
 
 ir_function::ir_function(const char *name)
-   : name(name)
 {
-   /* empty */
+   this->name = talloc_strdup(this, name);
 }
 
 



More information about the mesa-commit mailing list