mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
util/ralloc: Switch from DEBUG to NDEBUG
The debug code is all asserts, so protect it with the same thing that controls assert. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
34dffcf913
commit
7e3748c268
1 changed files with 4 additions and 14 deletions
|
|
@ -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
|
||||
|
||||
|
|
@ -558,7 +556,7 @@ ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt,
|
|||
#define LMAGIC 0x87b9c7d3
|
||||
|
||||
struct linear_header {
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
unsigned magic; /* for debugging */
|
||||
#endif
|
||||
unsigned offset; /* points to the first unused byte in the buffer */
|
||||
|
|
@ -608,7 +606,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;
|
||||
|
|
@ -628,9 +626,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);
|
||||
|
|
@ -702,9 +698,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;
|
||||
|
|
@ -723,9 +717,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);
|
||||
|
|
@ -738,9 +730,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue