From cd3e39340f057712fcf02a35dff85645e475053a Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 21 Apr 2007 12:08:56 -0600 Subject: Use new memory pool allocator. Lots of debug code still in place... --- src/mesa/shader/slang/slang_label.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/mesa/shader/slang/slang_label.c') diff --git a/src/mesa/shader/slang/slang_label.c b/src/mesa/shader/slang/slang_label.c index e6a03f9e4f..a4529be74f 100644 --- a/src/mesa/shader/slang/slang_label.c +++ b/src/mesa/shader/slang/slang_label.c @@ -8,14 +8,24 @@ #include "slang_label.h" +#include "slang_mem.h" + slang_label * _slang_label_new(const char *name) { +#if !USE_MEMPOOL slang_label *l = (slang_label *) _mesa_calloc(sizeof(slang_label)); +#else + slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); +#endif if (l) { +#if !USE_MEMPOOL l->Name = _mesa_strdup(name); +#else + l->Name = _slang_strdup(name); +#endif l->Location = -1; } return l; @@ -28,9 +38,17 @@ slang_label * _slang_label_new_unique(const char *name) { static int id = 1; +#if !USE_MEMPOOL slang_label *l = (slang_label *) _mesa_calloc(sizeof(slang_label)); +#else + slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); +#endif if (l) { +#if !USE_MEMPOOL l->Name = (char *) _mesa_malloc(_mesa_strlen(name) + 10); +#else + l->Name = (char *) _slang_alloc(_mesa_strlen(name) + 10); +#endif if (!l->Name) { _mesa_free(l); return NULL; @@ -45,11 +63,13 @@ _slang_label_new_unique(const char *name) void _slang_label_delete(slang_label *l) { +#if !USE_MEMPOOL if (l->Name) _mesa_free(l->Name); if (l->References) _mesa_free(l->References); _mesa_free(l); +#endif } @@ -58,8 +78,13 @@ _slang_label_add_reference(slang_label *l, GLuint inst) { const GLuint oldSize = l->NumReferences * sizeof(GLuint); assert(l->Location < 0); +#if !USE_MEMPOOL l->References = _mesa_realloc(l->References, oldSize, oldSize + sizeof(GLuint)); +#else + l->References = _slang_realloc(l->References, + oldSize, oldSize + sizeof(GLuint)); +#endif if (l->References) { l->References[l->NumReferences] = inst; l->NumReferences++; @@ -92,7 +117,9 @@ _slang_label_set_location(slang_label *l, GLint location, } if (l->References) { +#if !USE_MEMPOOL _mesa_free(l->References); +#endif l->References = NULL; } } -- cgit v1.2.3