forked from Shallyn/pyWaveformGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyAlloc.h
32 lines (28 loc) · 775 Bytes
/
myAlloc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Writer: Xiaolin.liu
*
* This module contains basic functions for calculation.
* Functions list:
* Kernel:
* 20xx.xx.xx, LOC
**/
#ifndef __INCLUDE_MYALLOC__
#define __INCLUDE_MYALLOC__
#include <stddef.h>
#include "myDatatypes.h"
#define CHECK_MEM_LEAK 1
void *myMallocLong(size_t n, const char *file, int line);
void *myCallocLong(size_t m, size_t n, const char *file, int line);
void myFree(void *p);
void CheckMemoryLeak();
#if CHECK_MEM_LEAK
#define MYMalloc(n) myMallocLong(n, __FILE__, __LINE__)
#define MYCalloc(m, n) myCallocLong(m, n, __FILE__, __LINE__)
#define MYFree(p) myFree(p)
#else
#define MYMalloc(n) malloc(n)
#define MYCalloc(m, n) calloc(m, n)
#define MYFree(p) myFree(p)
#endif
#endif