Hi,
I would like to discuss two different ways to virtualize (don't know if this is the right expression) the way, memory is allocated:
1. use malloc() and free() and if you like to replace them, you provide a file mem.h
#define malloc(x) myalloc(x)
void *myalloc(unsigned size);
#define free(p) myfree(p)
void myfree(void *p);
and if necessary a corresponding file mem.c
2. use not the standard names. Use something like ALLOC() and FREE() instead and provide a file mem.h
#define ALLOC(x) myalloc(x)
void *myalloc(unsigned size);
#define FREE(p) myfree(p)
void myfree(void *p);
and if necessary a corresponding file mem.c.
There are pros and cons for both methods. Sometimes I use the first, sometimes I use the second.
What do you think about?