]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - util.c
Removed primitive AST tree generator ... I'm planning a rewrite as we speak.
[xonotic/gmqcc.git] / util.c
diff --git a/util.c b/util.c
index a15590791f009719d85c23e47dc3c9ca744636ef..76bd44865c8164c1592c8c370dac252e02789b7a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -39,7 +39,7 @@ void *util_memory_a(unsigned int byte, unsigned int line, const char *file) {
        data->byte = byte;
        data->file = file;
        
-       printf("[MEM] allocation: %08u (bytes) at %s:%u\n", byte, file, line);
+       util_debug("MEM", "allocation: %08u (bytes) at %s:%u\n", byte, file, line);
        return (void*)((uintptr_t)data+sizeof(struct memblock_t));
 }
 
@@ -48,7 +48,7 @@ void util_memory_d(void *ptrn, unsigned int line, const char *file) {
        void              *data = (void*)((uintptr_t)ptrn-sizeof(struct memblock_t));
        struct memblock_t *info = (struct memblock_t*)data;
        
-       printf("[MEM] released:   %08u (bytes) at %s:%u\n", info->byte, file, line);
+       util_debug("MEM", "released:   %08u (bytes) at %s:%u\n", info->byte, file, line);
        free(data);
 }
 
@@ -81,9 +81,13 @@ char *util_strdup(const char *s) {
        return ptr;
 }
 
-void util_debug(const char *ms, ...) {
+void util_debug(const char *area, const char *ms, ...) {
        va_list  va;
        va_start(va, ms);
-       vprintf (ms, va);
+       fprintf (stdout, "DEBUG: ");
+       fputc   ('[',  stdout);
+       fprintf (stdout, area);
+       fputs   ("] ", stdout);
+       vfprintf(stdout, ms, va);
        va_end  (va);
 }