diff options
author | Jason Evans <je@fb.com> | 2012-02-10 20:22:09 -0800 |
---|---|---|
committer | Jason Evans <je@fb.com> | 2012-02-10 20:22:09 -0800 |
commit | 7372b15a31c63ac5cb9ed8aeabc2a0a3c005e8bf (patch) | |
tree | 9b0f1156e6aa61f50a01c90b72fdaefeabe414a8 /include/jemalloc/internal/chunk.h | |
parent | b3bd885090230cc28add77c399b4ed440b760ca3 (diff) | |
download | jemalloc-7372b15a31c63ac5cb9ed8aeabc2a0a3c005e8bf.tar.gz |
Reduce cpp conditional logic complexity.
Convert configuration-related cpp conditional logic to use static
constant variables, e.g.:
#ifdef JEMALLOC_DEBUG
[...]
#endif
becomes:
if (config_debug) {
[...]
}
The advantage is clearer, more concise code. The main disadvantage is
that data structures no longer have conditionally defined fields, so
they pay the cost of all fields regardless of whether they are used. In
practice, this is only a minor concern; config_stats will go away in an
upcoming change, and config_prof is the only other major feature that
depends on more than a few special-purpose fields.
Diffstat (limited to 'include/jemalloc/internal/chunk.h')
-rw-r--r-- | include/jemalloc/internal/chunk.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/include/jemalloc/internal/chunk.h b/include/jemalloc/internal/chunk.h index 54b6a3e..4cc1e80 100644 --- a/include/jemalloc/internal/chunk.h +++ b/include/jemalloc/internal/chunk.h @@ -28,20 +28,14 @@ #ifdef JEMALLOC_H_EXTERNS extern size_t opt_lg_chunk; -#ifdef JEMALLOC_SWAP extern bool opt_overcommit; -#endif -#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) /* Protects stats_chunks; currently not used for any other purpose. */ extern malloc_mutex_t chunks_mtx; /* Chunk statistics. */ extern chunk_stats_t stats_chunks; -#endif -#ifdef JEMALLOC_IVSALLOC extern rtree_t *chunks_rtree; -#endif extern size_t chunksize; extern size_t chunksize_mask; /* (chunksize - 1). */ |