diff options
Diffstat (limited to 'src/mesa/shader/slang/slang_vartable.c')
-rw-r--r-- | src/mesa/shader/slang/slang_vartable.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/shader/slang/slang_vartable.c index 27f8aeb4bde..5814481ea79 100644 --- a/src/mesa/shader/slang/slang_vartable.c +++ b/src/mesa/shader/slang/slang_vartable.c @@ -50,11 +50,7 @@ slang_var_table * _slang_new_var_table(GLuint maxRegisters) { slang_var_table *vt -#if USE_MEMPOOL = (slang_var_table *) _slang_alloc(sizeof(slang_var_table)); -#else - = (slang_var_table *) _mesa_calloc(sizeof(slang_var_table)); -#endif if (vt) { vt->MaxRegisters = maxRegisters; } @@ -69,9 +65,7 @@ _slang_delete_var_table(slang_var_table *vt) _mesa_problem(NULL, "non-empty var table in _slang_delete_var_table()"); return; } -#if !USE_MEMPOOL - _mesa_free(vt); -#endif + _slang_free(vt); } @@ -84,11 +78,7 @@ _slang_delete_var_table(slang_var_table *vt) void _slang_push_var_table(slang_var_table *vt) { -#if USE_MEMPOOL struct table *t = (struct table *) _slang_alloc(sizeof(struct table)); -#else - struct table *t = (struct table *) _mesa_calloc(sizeof(struct table)); -#endif if (t) { t->Level = vt->CurLevel++; t->Parent = vt->Top; @@ -147,17 +137,13 @@ _slang_pop_var_table(slang_var_table *vt) } } - if (t->Vars) -#if USE_MEMPOOL + if (t->Vars) { + _slang_free(t->Vars); t->Vars = NULL; -#else - free(t->Vars); -#endif + } vt->Top = t->Parent; -#if !USE_MEMPOOL - free(t); -#endif + _slang_free(t); vt->CurLevel--; } @@ -173,14 +159,10 @@ _slang_add_variable(slang_var_table *vt, slang_variable *v) t = vt->Top; assert(t); if (dbg) printf("Adding var %s\n", (char *) v->a_name); -#if USE_MEMPOOL - t->Vars = - (slang_variable **) _slang_realloc(t->Vars, - t->NumVars * sizeof(slang_variable *), - (t->NumVars + 1) * sizeof(slang_variable *)); -#else - t->Vars = realloc(t->Vars, (t->NumVars + 1) * sizeof(slang_variable *)); -#endif + t->Vars = (slang_variable **) + _slang_realloc(t->Vars, + t->NumVars * sizeof(slang_variable *), + (t->NumVars + 1) * sizeof(slang_variable *)); t->Vars[t->NumVars] = v; t->NumVars++; } |