aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/glsl_symbol_table.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-07-16 08:53:23 +0200
committermarha <marha@users.sourceforge.net>2013-07-16 08:53:23 +0200
commit06f4de23ace4de1fd628c37891214f0a4ecb77db (patch)
tree38ba52b20ef6060eab6e9b91e2c022e7a953e06b /mesalib/src/glsl/glsl_symbol_table.cpp
parentffce4319c2fb6f4f663cc5a9660e1d5837fcde87 (diff)
downloadvcxsrv-06f4de23ace4de1fd628c37891214f0a4ecb77db.tar.gz
vcxsrv-06f4de23ace4de1fd628c37891214f0a4ecb77db.tar.bz2
vcxsrv-06f4de23ace4de1fd628c37891214f0a4ecb77db.zip
libxcb xcb-proto mesa xkbcomp git update 16 Jul 2013
libxcb commit 45619dc71e9411a526d7c69595cf615b1b1206cf libxcb/xcb-proto commit 56a82005ac388fcb7a4d1c82e07c7e72eaf69a32 xkbcomp commit 1cd5c50c54b06de2238d6d7675d0a3c65a21414d mesa commit e4fdf1b008ce29c5b5a52985c586b61f35d31e4c
Diffstat (limited to 'mesalib/src/glsl/glsl_symbol_table.cpp')
-rw-r--r--mesalib/src/glsl/glsl_symbol_table.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/mesalib/src/glsl/glsl_symbol_table.cpp b/mesalib/src/glsl/glsl_symbol_table.cpp
index 0bea5364e..4c96620bf 100644
--- a/mesalib/src/glsl/glsl_symbol_table.cpp
+++ b/mesalib/src/glsl/glsl_symbol_table.cpp
@@ -175,13 +175,21 @@ bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
}
-bool glsl_symbol_table::add_type_ast(const char *name, const class ast_type_specifier *a)
+static char *make_ast_name(const char *name)
{
- symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(a);
- char ast_name[strlen("#ast.") + strlen(name) + 1];
+ char *ast_name = new char[strlen("#ast.") + strlen(name) + 1];
strcpy(ast_name, "#ast.");
strcat(ast_name + strlen("#ast."), name);
- return _mesa_symbol_table_add_symbol(table, -1, ast_name, entry) == 0;
+ return ast_name;
+}
+
+bool glsl_symbol_table::add_type_ast(const char *name, const class ast_type_specifier *a)
+{
+ symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(a);
+ char *ast_name = make_ast_name(name);
+ bool ret = _mesa_symbol_table_add_symbol(table, -1, ast_name, entry) == 0;
+ delete [] ast_name;
+ return ret;
}
bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
@@ -237,10 +245,9 @@ const glsl_type *glsl_symbol_table::get_type(const char *name)
const class ast_type_specifier *glsl_symbol_table::get_type_ast(const char *name)
{
- char ast_name[strlen("#ast.") + strlen(name) + 1];
- strcpy(ast_name, "#ast.");
- strcat(ast_name + strlen("#ast."), name);
+ char *ast_name = make_ast_name(name);
symbol_table_entry *entry = get_entry(ast_name);
+ delete [] ast_name;
return entry != NULL ? entry->a : NULL;
}