summaryrefslogtreecommitdiff
path: root/src/mesa/shader/symbol_table.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-07-27 12:19:14 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-07-27 12:19:14 -0700
commit946ea82bff530ac7aa8f5ebe56704fde62e14e86 (patch)
tree83a1a8d844c2adea2fad43f2368ae0ecade43cd5 /src/mesa/shader/symbol_table.c
parent0044d3ba94f9041492ea90cf8961fd8b55daefda (diff)
Add destructor for symbol_table
Diffstat (limited to 'src/mesa/shader/symbol_table.c')
-rw-r--r--src/mesa/shader/symbol_table.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/shader/symbol_table.c
index b90c495cdb..71ce1287f5 100644
--- a/src/mesa/shader/symbol_table.c
+++ b/src/mesa/shader/symbol_table.c
@@ -325,10 +325,24 @@ _mesa_symbol_table_ctor(void)
{
struct _mesa_symbol_table *table = calloc(1, sizeof(*table));
- table->ht = hash_table_ctor(32, hash_table_string_hash,
- hash_table_string_compare);
+ if (table != NULL) {
+ table->ht = hash_table_ctor(32, hash_table_string_hash,
+ hash_table_string_compare);
- _mesa_symbol_table_push_scope(table);
+ _mesa_symbol_table_push_scope(table);
+ }
return table;
}
+
+
+void
+_mesa_symbol_table_dtor(struct _mesa_symbol_table *table)
+{
+ while (table->current_scope != NULL) {
+ _mesa_symbol_table_pop_scope(table);
+ }
+
+ hash_table_dtor(table->ht);
+ free(table);
+}