X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fenums.c;fp=source%2Fenums.c;h=25fdaefda4eaff4fc7fcc0957b81593de9d93257;hb=3c32a221de1435ae7af8d96182560e8b28f1a4c0;hp=4875aa366aec8e5dbd6ab7997e1b04f117f6f4b5;hpb=7c57338619688bc07f394ad82f75471aefbecc59;p=gldbg.git diff --git a/source/enums.c b/source/enums.c index 4875aa3..25fdaef 100644 --- a/source/enums.c +++ b/source/enums.c @@ -8,6 +8,7 @@ Distributed under the GPL #include #include #include "enums.h" +#include "tmpalloc.h" typedef struct sEnumInfo { @@ -18,21 +19,6 @@ typedef struct sEnumInfo #include "enums.table" -char *buffer = 0; -unsigned buf_pos = 0; - -static char *buf_reserve(unsigned size) -{ - char *ptr; - if(!buffer) - buffer = (char *)malloc(2048); - if(buf_pos+size>2048) - buf_pos = 0; - ptr = buffer+buf_pos; - buf_pos += size; - return ptr; -} - const char *describe_enum(GLenum value, const char *categ) { unsigned low = 0; @@ -64,7 +50,7 @@ const char *describe_enum(GLenum value, const char *categ) if(enums[high].value==value) return enums[high].name; - ptr = buf_reserve(20); + ptr = (char *)tmpalloc(20); snprintf(ptr, 20, "GLenum(0x%X)", value); return ptr; } @@ -72,7 +58,7 @@ const char *describe_enum(GLenum value, const char *categ) const char *describe_bitfield(int mask, const char *categ) { int bit; - char *buf = buf_reserve(200); + char *buf = (char *)tmpalloc(200); char *ptr = buf; for(bit=1; bit; bit<<=1)