home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-09 | 910 b | 70 lines | [TEXT/KAHL] |
- #undef malloc
- #undef calloc
- #undef realloc
- #undef free
-
- static logging = 0;
-
- init_xalloc(void)
- {
- logging = 0;
- }
-
- end_xalloc(void)
- {
- logging = 0;
- }
-
- static unsigned long probef(void) = 0x2016;
-
- void xdebug_tree(void *addr)
- {
- if (logging)
- {
- logging = 0;
- debug_dump_tree(addr);
- logging = 1;
- }
- }
-
- void *xmalloc(long siz)
- {
- void *tmp;
- if (logging)
- {
- logging = 0;
- fprintf(stderr,"xmalloc %ld at %lx\n", siz, probef());
- logging = 1;
- }
- tmp = malloc(siz);
- bzero(tmp, siz);
- return tmp;
- }
-
- void *xrealloc(void *ptr, long siz)
- {
- if (logging)
- {
- logging = 0;
- fprintf(stderr,"xrealloc %ld at %lx\n", siz, probef());
- logging = 1;
- }
- return realloc(ptr, siz);
- }
-
- void *xcalloc(long x,long y)
- {
- if (logging)
- {
- logging = 0;
- fprintf(stderr,"xcalloc %ld at %lx\n", x*y, probef());
- logging = 1;
- }
- return calloc(x,y);
- }
-
- void xfree(void *ptr)
- {
- free(ptr);
- }
-