30 #ifndef GENSVM_MEMORY_H 31 #define GENSVM_MEMORY_H 40 #define Calloc(type, size) \ 41 mycalloc(__FILE__, __LINE__, size, sizeof(type)) 48 #define Malloc(type, size) \ 49 mymalloc(__FILE__, __LINE__, (size)*sizeof(type)) 55 #define Realloc(var, type, size) \ 56 myrealloc(__FILE__, __LINE__, (size)*sizeof(type), var) 61 #define Memset(var, type, size) \ 62 memset(var, 0, (size)*sizeof(type)) 64 void *
mycalloc(
const char *file,
int line,
unsigned long size,
66 void *
mymalloc(
const char *file,
int line,
unsigned long size);
67 void *
myrealloc(
const char *file,
int line,
unsigned long size,
void *var);
void * mycalloc(const char *file, int line, unsigned long size, size_t typesize)
Wrapper for calloc() which warns when allocation fails.
void * myrealloc(const char *file, int line, unsigned long size, void *var)
Wrapper for realloc() which warns when allocation fails.
void * mymalloc(const char *file, int line, unsigned long size)
Wrapper for malloc() which warns when allocation fails.