summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_compile_struct.c
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-04-21 12:08:56 -0600
committerBrian <brian@yutani.localnet.net>2007-04-21 12:30:58 -0600
commitcd3e39340f057712fcf02a35dff85645e475053a (patch)
treea7c6e2d0d6be2ccaa882075539e38935b77b5522 /src/mesa/shader/slang/slang_compile_struct.c
parentad3cc95485c488e3920f9c460b373338043000c5 (diff)
Use new memory pool allocator. Lots of debug code still in place...
Diffstat (limited to 'src/mesa/shader/slang/slang_compile_struct.c')
-rw-r--r--src/mesa/shader/slang/slang_compile_struct.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_compile_struct.c b/src/mesa/shader/slang/slang_compile_struct.c
index 89c79d431b..4a4773217a 100644
--- a/src/mesa/shader/slang/slang_compile_struct.c
+++ b/src/mesa/shader/slang/slang_compile_struct.c
@@ -29,6 +29,7 @@
*/
#include "imports.h"
+#include "slang_mem.h"
#include "slang_compile.h"
@@ -47,7 +48,11 @@ slang_struct_scope_destruct(slang_struct_scope * scope)
for (i = 0; i < scope->num_structs; i++)
slang_struct_destruct(scope->structs + i);
+#if USE_MEMPOOL
+ _slang_free(scope->structs);
+#else
slang_alloc_free(scope->structs);
+#endif
/* do not free scope->outer_scope */
}
@@ -59,7 +64,11 @@ slang_struct_scope_copy(slang_struct_scope * x, const slang_struct_scope * y)
_slang_struct_scope_ctr(&z);
z.structs =
+#if USE_MEMPOOL
+ (slang_struct *) _slang_alloc(y->num_structs *
+#else
(slang_struct *) slang_alloc_malloc(y->num_structs *
+#endif
sizeof(slang_struct));
if (z.structs == NULL) {
slang_struct_scope_destruct(&z);
@@ -102,16 +111,28 @@ slang_struct_construct(slang_struct * stru)
{
stru->a_name = SLANG_ATOM_NULL;
stru->fields = (slang_variable_scope *)
+#if USE_MEMPOOL
+ _slang_alloc(sizeof(slang_variable_scope));
+#else
slang_alloc_malloc(sizeof(slang_variable_scope));
+#endif
if (stru->fields == NULL)
return 0;
_slang_variable_scope_ctr(stru->fields);
stru->structs =
+#if USE_MEMPOOL
+ (slang_struct_scope *) _slang_alloc(sizeof(slang_struct_scope));
+#else
(slang_struct_scope *) slang_alloc_malloc(sizeof(slang_struct_scope));
+#endif
if (stru->structs == NULL) {
slang_variable_scope_destruct(stru->fields);
+#if USE_MEMPOOL
+ _slang_free(stru->fields);
+#else
slang_alloc_free(stru->fields);
+#endif
return 0;
}
_slang_struct_scope_ctr(stru->structs);
@@ -122,9 +143,17 @@ void
slang_struct_destruct(slang_struct * stru)
{
slang_variable_scope_destruct(stru->fields);
+#if USE_MEMPOOL
+ _slang_free(stru->fields);
+#else
slang_alloc_free(stru->fields);
+#endif
slang_struct_scope_destruct(stru->structs);
+#if USE_MEMPOOL
+ _slang_free(stru->structs);
+#else
slang_alloc_free(stru->structs);
+#endif
}
int