diff options
author | Mike Hommey <mh@glandium.org> | 2012-04-24 23:22:02 +0200 |
---|---|---|
committer | Jason Evans <je@fb.com> | 2012-04-29 00:25:34 -0700 |
commit | 8b49971d0ce0819af78aa2a278c26ecb298ee134 (patch) | |
tree | e950255d8d25d34ad7d989c03dfd82c421c7702a /include/jemalloc/internal/prof.h | |
parent | f27899402914065a6c1484ea8d81a2c8b70aa659 (diff) | |
download | jemalloc-8b49971d0ce0819af78aa2a278c26ecb298ee134.tar.gz |
Avoid variable length arrays and remove declarations within code
MSVC doesn't support C99, and building as C++ to be able to use them is
dangerous, as C++ and C99 are incompatible.
Introduce a VARIABLE_ARRAY macro that either uses VLA when supported,
or alloca() otherwise. Note that using alloca() inside loops doesn't
quite work like VLAs, thus the use of VARIABLE_ARRAY there is discouraged.
It might be worth investigating ways to check whether VARIABLE_ARRAY is
used in such context at runtime in debug builds and bail out if that
happens.
Diffstat (limited to 'include/jemalloc/internal/prof.h')
-rw-r--r-- | include/jemalloc/internal/prof.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/jemalloc/internal/prof.h b/include/jemalloc/internal/prof.h index 41a6692..c3e3f9e 100644 --- a/include/jemalloc/internal/prof.h +++ b/include/jemalloc/internal/prof.h @@ -542,8 +542,9 @@ prof_free(const void *ptr, size_t size) cassert(config_prof); if ((uintptr_t)ctx > (uintptr_t)1) { + prof_thr_cnt_t *tcnt; assert(size == isalloc(ptr, true)); - prof_thr_cnt_t *tcnt = prof_lookup(ctx->bt); + tcnt = prof_lookup(ctx->bt); if (tcnt != NULL) { tcnt->epoch++; |