tags:

views:

42

answers:

1

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?

A: 

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.

Remo.D
Yes I know what it means. And they don't redefine JEMALLOC_P in any other place of the code. So I assumed that they are using # define JEMALLOC_P(s) s as default. But why the hell they are using this? AFAIK it doesn't change anything in the code? it just takes a function and return it back.
systemsfault