--- /dev/null
+/* $Id$
+
+This file is part of gldbg
+Copyright © 2009 Mikko Rasa, Mikkosoft Productions
+Distributed under the GPL
+*/
+
+#include <stdlib.h>
+#include "tmpalloc.h"
+
+void *buffer = 0;
+unsigned buf_size = 8192;
+unsigned offset = 0;
+
+void *tmpalloc(unsigned size)
+{
+ void *ptr;
+ if(!buffer)
+ buffer = malloc(buf_size);
+ if(offset+size>buf_size)
+ offset = 0;
+ ptr = (char *)buffer+offset;
+ offset += size;
+ return ptr;
+}
+
+void tmpfree()
+{
+ free(buffer);
+ buffer = 0;
+ offset = 0;
+}