From 78f7352259768f670f8e1f9b000388dd32b62493 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Wed, 18 Apr 2012 13:38:40 -0700 Subject: Clean up a few config-related conditionals/asserts. Clean up a few config-related conditionals to avoid unnecessary dependencies on prof symbols. Use cassert() rather than assert() everywhere that it's appropriate. --- src/arena.c | 10 ++++++---- src/quarantine.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/arena.c b/src/arena.c index 989034d..0f15562 100644 --- a/src/arena.c +++ b/src/arena.c @@ -1213,7 +1213,9 @@ void arena_prof_accum(arena_t *arena, uint64_t accumbytes) { - if (prof_interval != 0) { + cassert(config_prof); + + if (config_prof && prof_interval != 0) { arena->prof_accumbytes += accumbytes; if (arena->prof_accumbytes >= prof_interval) { prof_idump(); @@ -1490,8 +1492,8 @@ arena_salloc(const void *ptr, bool demote) } else { assert(((uintptr_t)ptr & PAGE_MASK) == 0); ret = mapbits & ~PAGE_MASK; - if (demote && prof_promote && ret == PAGE && (mapbits & - CHUNK_MAP_CLASS_MASK) != 0) { + if (config_prof && demote && prof_promote && ret == PAGE && + (mapbits & CHUNK_MAP_CLASS_MASK) != 0) { size_t binind = ((mapbits & CHUNK_MAP_CLASS_MASK) >> CHUNK_MAP_CLASS_SHIFT) - 1; assert(binind < NBINS); @@ -1509,7 +1511,7 @@ arena_prof_promoted(const void *ptr, size_t size) arena_chunk_t *chunk; size_t pageind, binind; - assert(config_prof); + cassert(config_prof); assert(ptr != NULL); assert(CHUNK_ADDR2BASE(ptr) != ptr); assert(isalloc(ptr, false) == PAGE); diff --git a/src/quarantine.c b/src/quarantine.c index 89a25c6..5fb6c39 100644 --- a/src/quarantine.c +++ b/src/quarantine.c @@ -101,7 +101,7 @@ quarantine(void *ptr) quarantine_t *quarantine; size_t usize = isalloc(ptr, config_prof); - assert(config_fill); + cassert(config_fill); assert(opt_quarantine); quarantine = *quarantine_tsd_get(); @@ -154,7 +154,7 @@ bool quarantine_boot(void) { - assert(config_fill); + cassert(config_fill); if (quarantine_tsd_boot()) return (true); -- cgit v0.12