Mesa (master): util: Don't use 0-sized arrays.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Tue Feb 24 07:44:18 PST 2009
Module: Mesa
Branch: master
Commit: 8f3c1cddaa9c307f70fca0e1a917397a7d85c238
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f3c1cddaa9c307f70fca0e1a917397a7d85c238
Author: José Fonseca <jfonseca at vmware.com>
Date: Tue Feb 24 15:44:09 2009 +0000
util: Don't use 0-sized arrays.
Not supported by MSVC.
---
src/gallium/auxiliary/util/u_debug_memory.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_debug_memory.c b/src/gallium/auxiliary/util/u_debug_memory.c
index 758541c..7623cb9 100644
--- a/src/gallium/auxiliary/util/u_debug_memory.c
+++ b/src/gallium/auxiliary/util/u_debug_memory.c
@@ -73,7 +73,9 @@ struct debug_memory_header
const char *file;
unsigned line;
const char *function;
+#if DEBUG_MEMORY_STACK
struct debug_stack_frame backtrace[DEBUG_MEMORY_STACK];
+#endif
size_t size;
unsigned magic;
@@ -140,7 +142,9 @@ debug_malloc(const char *file, unsigned line, const char *function,
hdr->size = size;
hdr->magic = DEBUG_MEMORY_MAGIC;
+#if DEBUG_MEMORY_STACK
debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK);
+#endif
ftr = footer_from_header(hdr);
ftr->magic = DEBUG_MEMORY_MAGIC;
@@ -296,7 +300,9 @@ debug_memory_end(unsigned long start_no)
debug_printf("%s:%u:%s: %u bytes at %p not freed\n",
hdr->file, hdr->line, hdr->function,
hdr->size, ptr);
+#if DEBUG_MEMORY_STACK
debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK);
+#endif
total_size += hdr->size;
}
More information about the mesa-commit
mailing list