home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_01_01
/
1n01082a
< prev
next >
Wrap
Text File
|
1990-05-17
|
1KB
|
42 lines
/*
Header: PtrDebug
Version: 1.00
Language: ANSI C
Environ: Any
Purpose: Provides debug replacements for the standard
dynamic memory allocation functions.
Written by: Scott Robert Ladd
*/
#if !defined(_PTRDEBUG_H)
#define _PTRDEBUG_H
#include "stddef.h"
/* change calls to traditional functions to call debug functions */
#if !defined(NO_PTRDEBUG_DEF)
#define malloc(a) dbg_malloc(a,__FILE__,__LINE__)
#define calloc(a,b) dbg_calloc(a,b,__FILE__,__LINE__)
#define realloc(a,b) dbg_realloc(a,b,__FILE__,__LINE__)
#define free(a) dbg_free(&a,__FILE__,__LINE__)
#define strdup(a) dbg_strdup(a,__FILE__,__LINE__)
#endif
/* prototypes for debug functions */
void * dbg_malloc(size_t len, char * file, int line);
void * dbg_calloc(size_t num, size_t len, char * file, int line);
void * dbg_realloc(void * ptr, size_t len, char * file, int line);
void dbg_free(void ** ptr, char * file, int line);
char * dbg_strdup(char * str, char * file, int line);
#endif