Ex36: Why use a macro to use malloc and free?

In the bstring library the header defines the following:

#ifndef bstr__alloc
#define bstr__alloc(x) malloc(x)
#endif

#ifndef bstr__free
#define bstr_free(p) free(p)
#endif

What is the use of such definition? Why not use malloc and free directly?

EDIT1: One disadvantage is that you cannot directly check the call, because you have to go to the macro first. By the time you see the definition, you have lost sight of the actual arguments. Makes reviewing more difficult than necessary.

Kind regards, Guus.

I have no idea, bstrlib is a little old at this point. My thinking is some super broken operating systems on embedded devices don’t have a normal malloc and free, so you need to change it. Otherwise it’s probably pointless on their part since, I mean, you can just redefine free/malloc to whatever you need.