forgot to add the chkalloc files
[dos_imgv] / src / chkalloc.h
1 #ifndef CHKALLOC_H_
2 #define CHKALLOC_H_
3
4 #ifdef CHECK_ALLOC
5
6 void chk_check(void);
7
8 #define chk_malloc(sz)          chk_malloc_impl(sz, __FILE__, __LINE__)
9 #define chk_realloc(p, sz)      chk_realloc_impl(p, sz, __FILE__, __LINE__)
10
11 void *chk_malloc_impl(int sz, char *file, int line);
12 void *chk_realloc_impl(void *ptr, int sz, char *file, int line);
13 void chk_free(void *p);
14
15 #else   /* !CHECK_ALLOC */
16
17 #include <stdlib.h>
18
19 #define chk_check()
20 #define chk_malloc(sz)          malloc(sz)
21 #define chk_realloc(p, sz)      realloc(p, sz)
22 #define chk_free(p)                     free(p)
23
24 #endif  /* CHECK_ALLOC */
25
26 #endif  /* CHKALLOC_H_ */