proper mem accounting

This commit is contained in:
David Rose 2008-07-10 22:48:16 +00:00
parent 1595033587
commit 4187bbd8bf

View File

@ -2,20 +2,23 @@
* Memory allocator for TinyGL * Memory allocator for TinyGL
*/ */
#include "zgl.h" #include "zgl.h"
#include "memoryHook.h"
/* modify these functions so that they suit your needs */ /* modify these functions so that they suit your needs */
void gl_free(void *p) void gl_free(void *p)
{ {
free(p); PANDA_FREE_ARRAY(p);
} }
void *gl_malloc(int size) void *gl_malloc(int size)
{ {
return malloc(size); return PANDA_MALLOC_ARRAY(size);
} }
void *gl_zalloc(int size) void *gl_zalloc(int size)
{ {
return calloc(1, size); void *buffer = PANDA_MALLOC_ARRAY(size);
memset(buffer, 0, size);
return buffer;
} }