diff options
Diffstat (limited to 'lib/mesa/src/util/ralloc.c')
-rw-r--r-- | lib/mesa/src/util/ralloc.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/mesa/src/util/ralloc.c b/lib/mesa/src/util/ralloc.c index 5a7fa7e84..fc3566199 100644 --- a/lib/mesa/src/util/ralloc.c +++ b/lib/mesa/src/util/ralloc.c @@ -61,7 +61,7 @@ struct #endif ralloc_header { -#ifdef DEBUG +#ifndef NDEBUG /* A canary value used to determine whether a pointer is ralloc'd. */ unsigned canary; #endif @@ -88,9 +88,7 @@ get_header(const void *ptr) { ralloc_header *info = (ralloc_header *) (((char *) ptr) - sizeof(ralloc_header)); -#ifdef DEBUG assert(info->canary == CANARY); -#endif return info; } @@ -140,7 +138,7 @@ ralloc_size(const void *ctx, size_t size) add_child(parent, info); -#ifdef DEBUG +#ifndef NDEBUG info->canary = CANARY; #endif @@ -566,7 +564,7 @@ struct __attribute__((aligned(8))) #endif linear_header { -#ifdef DEBUG +#ifndef NDEBUG unsigned magic; /* for debugging */ #endif unsigned offset; /* points to the first unused byte in the buffer */ @@ -616,7 +614,7 @@ create_linear_node(void *ralloc_ctx, unsigned min_size) if (unlikely(!node)) return NULL; -#ifdef DEBUG +#ifndef NDEBUG node->magic = LMAGIC; #endif node->offset = 0; @@ -636,9 +634,7 @@ linear_alloc_child(void *parent, unsigned size) linear_size_chunk *ptr; unsigned full_size; -#ifdef DEBUG assert(first->magic == LMAGIC); -#endif assert(!latest->next); size = ALIGN_POT(size, SUBALLOC_ALIGNMENT); @@ -712,9 +708,7 @@ linear_free_parent(void *ptr) return; node = LINEAR_PARENT_TO_HEADER(ptr); -#ifdef DEBUG assert(node->magic == LMAGIC); -#endif while (node) { void *ptr = node; @@ -733,9 +727,7 @@ ralloc_steal_linear_parent(void *new_ralloc_ctx, void *ptr) return; node = LINEAR_PARENT_TO_HEADER(ptr); -#ifdef DEBUG assert(node->magic == LMAGIC); -#endif while (node) { ralloc_steal(new_ralloc_ctx, node); @@ -748,9 +740,7 @@ void * ralloc_parent_of_linear_parent(void *ptr) { linear_header *node = LINEAR_PARENT_TO_HEADER(ptr); -#ifdef DEBUG assert(node->magic == LMAGIC); -#endif return node->ralloc_parent; } |