GenSVM
gensvm_memory.h
Go to the documentation of this file.
1 
30 #ifndef GENSVM_MEMORY_H
31 #define GENSVM_MEMORY_H
32 
33 #include <stddef.h>
34 
40 #define Calloc(type, size) \
41  mycalloc(__FILE__, __LINE__, size, sizeof(type))
42 
48 #define Malloc(type, size) \
49  mymalloc(__FILE__, __LINE__, (size)*sizeof(type))
50 
55 #define Realloc(var, type, size) \
56  myrealloc(__FILE__, __LINE__, (size)*sizeof(type), var)
57 
61 #define Memset(var, type, size) \
62  memset(var, 0, (size)*sizeof(type))
63 
64 void *mycalloc(const char *file, int line, unsigned long size,
65  size_t typesize);
66 void *mymalloc(const char *file, int line, unsigned long size);
67 void *myrealloc(const char *file, int line, unsigned long size, void *var);
68 
69 #endif
void * mycalloc(const char *file, int line, unsigned long size, size_t typesize)
Wrapper for calloc() which warns when allocation fails.
Definition: gensvm_memory.c:48
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.
Definition: gensvm_memory.c:81