[Mesa-dev] [PATCH mesa 14/16] util/cache: use NDEBUG to guard asserts

Eric Engestrom eric.engestrom at imgtec.com
Fri Nov 24 18:07:54 UTC 2017


Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
 src/gallium/auxiliary/util/u_cache.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c
index c748cb99dd0c468f4342..f14ba97996873a716aff 100644
--- a/src/gallium/auxiliary/util/u_cache.c
+++ b/src/gallium/auxiliary/util/u_cache.c
@@ -56,7 +56,7 @@ struct util_cache_entry
    void *key;
    void *value;
    
-#ifdef DEBUG
+#ifndef NDEBUG
    unsigned count;
 #endif
 };
@@ -214,7 +214,7 @@ util_cache_set(struct util_cache *cache,
 
    util_cache_entry_destroy(cache, entry);
    
-#ifdef DEBUG
+#ifndef NDEBUG
    ++entry->count;
 #endif
    
@@ -289,7 +289,7 @@ util_cache_destroy(struct util_cache *cache)
    if (!cache)
       return;
 
-#ifdef DEBUG
+#ifndef NDEBUG
    if (cache->count >= 20*cache->size) {
       /* Normal approximation of the Poisson distribution */
       double mean = (double)cache->count/(double)cache->size;
@@ -341,7 +341,7 @@ util_cache_remove(struct util_cache *cache,
 static void
 ensure_sanity(const struct util_cache *cache)
 {
-#ifdef DEBUG
+#ifndef NDEBUG
    unsigned i, cnt = 0;
 
    assert(cache);
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list