Reputation: 15527
I was reading the jemalloc's realloc function and noticed that all the non-static functions(at least the ones I've seen) in jemalloc is wrapped with JEMALLOC_P macro and JEMALLOC_P is:
#define JEMALLOC_P(s) s
Why would they need such a thing?
Upvotes: 0
Views: 1045
Reputation: 434585
From the jemalloc configure
script:
AC_DEFINE_UNQUOTED([JEMALLOC_P(string_that_no_one_should_want_to_use_as_a_jemalloc_API_prefix)], [${JEMALLOC_PREFIX}##string_that_no_one_should_want_to_use_as_a_jemalloc_API_prefix])
I'd guess that it is intended to provide a prefix for all of the jemalloc functions.
You'll also see things like this in jemalloc.h
:
void *JEMALLOC_P(malloc)(size_t size)
So, by default, jemalloc takes over the malloc()
name but if you need to still use plain malloc()
then you could
#define JEMALLOC_P(s) je_##s
and get je_malloc()
and plain malloc()
at the same time.
Upvotes: 1
Reputation: 16512
You should look at the context that line is in. The code is actually:
#ifndef JEMALLOC_P
# define JEMALLOC_P(s) s
#endif
This means that, prior to including the header file, you could have provided your version of the JEMALLOC_P()
. If you haven't that is the default.
Upvotes: 1