aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2015-11-12 11:06:41 -0800
committerJason Evans <je@fb.com>2015-11-12 11:06:41 -0800
commitf9e3459f751b08b3c2108fda7462827cf8a4f2af (patch)
treecf0fc3b4cf73bf05da362427b9899b8e425aed66 /src
parenta6ec1c869e1abe3eb70616d19d3e553339449636 (diff)
downloadjemalloc-f9e3459f751b08b3c2108fda7462827cf8a4f2af.tar.gz
Tweak code to allow compilation of concatenated src/*.c sources.
This resolves #294.
Diffstat (limited to 'src')
-rw-r--r--src/ctl.c6
-rw-r--r--src/util.c13
2 files changed, 16 insertions, 3 deletions
diff --git a/src/ctl.c b/src/ctl.c
index 3de8e60..db1ddcb 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -115,7 +115,7 @@ CTL_PROTO(tcache_create)
CTL_PROTO(tcache_flush)
CTL_PROTO(tcache_destroy)
CTL_PROTO(arena_i_purge)
-static void arena_purge(unsigned arena_ind);
+static void arena_i_purge(unsigned arena_ind);
CTL_PROTO(arena_i_dss)
CTL_PROTO(arena_i_lg_dirty_mult)
CTL_PROTO(arena_i_chunk_hooks)
@@ -1538,7 +1538,7 @@ label_return:
/* ctl_mutex must be held during execution of this function. */
static void
-arena_purge(unsigned arena_ind)
+arena_i_purge(unsigned arena_ind)
{
tsd_t *tsd;
unsigned i;
@@ -1576,7 +1576,7 @@ arena_i_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
READONLY();
WRITEONLY();
malloc_mutex_lock(&ctl_mtx);
- arena_purge(mib[1]);
+ arena_i_purge(mib[1]);
malloc_mutex_unlock(&ctl_mtx);
ret = 0;
diff --git a/src/util.c b/src/util.c
index 4cb0d6c..1373ee1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,3 +1,7 @@
+/*
+ * Define simple versions of assertion macros that won't recurse in case
+ * of assertion failures in malloc_*printf().
+ */
#define assert(e) do { \
if (config_debug && !(e)) { \
malloc_write("<jemalloc>: Failed assertion\n"); \
@@ -648,3 +652,12 @@ malloc_printf(const char *format, ...)
malloc_vcprintf(NULL, NULL, format, ap);
va_end(ap);
}
+
+/*
+ * Restore normal assertion macros, in order to make it possible to compile all
+ * C files as a single concatenation.
+ */
+#undef assert
+#undef not_reached
+#undef not_implemented
+#include "jemalloc/internal/assert.h"