diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2006-11-24 19:01:14 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2006-11-24 19:01:14 +0000 |
commit | e49d06e61955208b9cd3e18469034e7447394b95 (patch) | |
tree | adba3a8148477f400f369cef640b67a9fb2c86bf /src/mesa/shader/slang/slang_compile_variable.c | |
parent | d4c4bdfa1e6bf35c84c4a2d5e18a70dbff11b101 (diff) |
new slang_variable_scope_grow() function
Diffstat (limited to 'src/mesa/shader/slang/slang_compile_variable.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile_variable.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index 92951b85bb..a37deddff1 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -181,6 +181,27 @@ slang_variable_scope_copy(slang_variable_scope * x, return 1; } + +/** + * Grow the variable list by one. + * \return pointer to space for the new variable. + */ +slang_variable * +slang_variable_scope_grow(slang_variable_scope *scope) +{ + const int n = scope->num_variables; + scope->variables = (slang_variable *) + slang_alloc_realloc(scope->variables, + n * sizeof(slang_variable), + (n + 1) * sizeof(slang_variable)); + if (!scope->variables) + return NULL; + scope->num_variables++; + return scope->variables + n; +} + + + /* slang_variable */ int |