Update the changelog
[opencv] / apps / cvenv / EiC / xalloc.h
1 /* xalloc.h
2  *
3  *      (C) Copyright Dec 12 1995, Edmond J. Breen.
4  *                 ALL RIGHTS RESERVED.
5  * This code may be copied for personal, non-profit use only.
6  *
7  */
8 #ifndef XALLOCH
9 #define XALLOCH
10
11
12
13 #define ymem
14 #ifdef ymem
15
16
17 #define xmalloc(N)          EiC_ymalloc(__FILE__,__LINE__,N)
18 #define xcalloc(N,M)        EiC_ycalloc(__FILE__,__LINE__,N,M)
19 #define xrealloc(N,M)       EiC_yrealloc(__FILE__,__LINE__,N,M)
20 #define xfree(N)            EiC_yfree(__FILE__,__LINE__,N)
21 #define xmark(N,M)          EiC_ymark(__FILE__,__LINE__,N,M)
22 #define xmemcheck()         ymemcheck(__FILE__,__LINE__)
23 #define xdumpnonmark(N,M)   EiC_ydumpnonmark(N,M)
24
25 void  EiC_xfreemark(char mark);
26 int   xexchmark(char oldmark, char newmark);
27 int   xlookup(void *p);
28
29 int EiC_getMemMark(unsigned long item);
30 void EiC_freeMemItem(unsigned long item);
31
32 void   EiC_xalloc_CleanUp(size_t bot, size_t top);
33 size_t EiC_xalloc_NextEntryNum(void);
34
35 void *EiC_ymalloc(char *file,int lineno, size_t nbytes);
36 void *EiC_ycalloc(char *file,int lineno,size_t nelem,size_t elemsize);
37 void *EiC_yrealloc(char *file,int lineno,void *block, size_t nbytes);
38 void EiC_yfree(char *file,int lineno,void *block);
39 int  EiC_ymark(char *file,int lineno,void *block,char mark);
40 void EiC_ydumpnonmark(char *outfile,char mark);
41
42
43 extern unsigned long EiC_tot_memory;   /* total amount of memory allocated */
44 extern size_t EiC_tot_alloc;       /* total number of blocks allocated */
45 extern size_t tot_seen;            /* total number of blocks seen */
46 extern char XGMARK;                /* memory mark, default = 0 */
47
48 #define MEM_LEAK   66
49 #define NON_LEAK   50
50
51 #define catchItem(X)  {size_t x = X; if(tot_seen == x)\
52                            printf("\n\tCAUGHT ITEM %lu at %d in %s\n\n",\
53                                   (unsigned long)x, __LINE__,__FILE__);}
54
55 #else
56 #define xmalloc(N)              malloc(N)
57 #define xcalloc(N,M)            calloc(N,M)
58 #define xrealloc(N,M)           realloc(N,M)
59 #define xfree(N)                free(N)
60
61 #endif
62 #endif
63
64
65
66
67
68
69
70