summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_typeinfo.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_typeinfo.c
parentad3cc95485c488e3920f9c460b373338043000c5 (diff)
Use new memory pool allocator. Lots of debug code still in place...
Diffstat (limited to 'src/mesa/shader/slang/slang_typeinfo.c')
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c
index 957c302c5b3..c688423d8d2 100644
--- a/src/mesa/shader/slang/slang_typeinfo.c
+++ b/src/mesa/shader/slang/slang_typeinfo.c
@@ -32,6 +32,7 @@
#include "slang_typeinfo.h"
#include "slang_compile.h"
#include "slang_log.h"
+#include "slang_mem.h"
#include "prog_instruction.h"
@@ -178,11 +179,19 @@ slang_type_specifier_dtr(slang_type_specifier * self)
{
if (self->_struct != NULL) {
slang_struct_destruct(self->_struct);
+#if USE_MEMPOOL
+ _slang_free(self->_struct);
+#else
slang_alloc_free(self->_struct);
+#endif
}
if (self->_array != NULL) {
slang_type_specifier_dtr(self->_array);
+#if USE_MEMPOOL
+ _slang_free(self->_array);
+#else
slang_alloc_free(self->_array);
+#endif
}
}
@@ -195,13 +204,21 @@ slang_type_specifier_copy(slang_type_specifier * x,
slang_type_specifier_ctr(&z);
z.type = y->type;
if (z.type == SLANG_SPEC_STRUCT) {
+#if USE_MEMPOOL
+ z._struct = (slang_struct *) _slang_alloc(sizeof(slang_struct));
+#else
z._struct = (slang_struct *) slang_alloc_malloc(sizeof(slang_struct));
+#endif
if (z._struct == NULL) {
slang_type_specifier_dtr(&z);
return GL_FALSE;
}
if (!slang_struct_construct(z._struct)) {
+#if USE_MEMPOOL
+ _slang_free(z._struct);
+#else
slang_alloc_free(z._struct);
+#endif
slang_type_specifier_dtr(&z);
return GL_FALSE;
}
@@ -213,7 +230,11 @@ slang_type_specifier_copy(slang_type_specifier * x,
else if (z.type == SLANG_SPEC_ARRAY) {
z._array =
(slang_type_specifier *)
+#if USE_MEMPOOL
+ _slang_alloc(sizeof(slang_type_specifier));
+#else
slang_alloc_malloc(sizeof(slang_type_specifier));
+#endif
if (z._array == NULL) {
slang_type_specifier_dtr(&z);
return GL_FALSE;
@@ -596,11 +617,19 @@ _slang_typeof_operation_(slang_operation * op,
/* struct initializer */
ti->spec.type = SLANG_SPEC_STRUCT;
ti->spec._struct =
+#if USE_MEMPOOL
+ (slang_struct *) _slang_alloc(sizeof(slang_struct));
+#else
(slang_struct *) slang_alloc_malloc(sizeof(slang_struct));
+#endif
if (ti->spec._struct == NULL)
return GL_FALSE;
if (!slang_struct_construct(ti->spec._struct)) {
+#if USE_MEMPOOL
+ _slang_free(ti->spec._struct);
+#else
slang_alloc_free(ti->spec._struct);
+#endif
ti->spec._struct = NULL;
return GL_FALSE;
}