home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / NCSATELN / TEL23SRC.ZIP / INCLUDE / MEMDEBUG.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-23  |  1.5 KB  |  47 lines

  1. /*----------------------------------------------------------------------
  2.  *
  3.  *  memdebug.h -- Dynamic memory handler interface
  4.  *  Description: memdebug.h provides the interface definitions for the dynamic
  5.  *  memory handler.
  6.  *  See memdebug.c for complete documentation.
  7.  *
  8.  */
  9.  
  10. /* Compilation options */
  11. #define MEM_LIST        /* Build internal list */
  12. #define MEM_WHERE        /* Keep track of memory block source */
  13. #define MEM_HEADER        /* Keep headers and footers around for each block */
  14. #define MEM_COMP_FREE    /* Complement the space free'd */
  15.  
  16. /* Interface functions */
  17. unsigned long    Mem_Used(void);
  18. void        Mem_Display(FILE *fp);
  19.  
  20. /* Interface functions to access only through macros */
  21. #if defined(MEM_WHERE)
  22. void    *mem_alloc(size_t size, char *fil, int lin);
  23. void    *mem_realloc(void *old_ptr, size_t size, char *fil, int lin);
  24. void    mem_free(void *ptr, char *fil, int lin);
  25. char    *mem_strdup(char *ptr, char *fil, int lin);
  26. #else
  27. void    *mem_alloc(size_t size) ;
  28. void    *mem_realloc(void *old_ptr, size_t size) ;
  29. void    mem_free(void *ptr) ;
  30. char    *mem_strdup(char *ptr) ;
  31. #endif
  32.  
  33. /* Interface macros */
  34. #if !defined(__MEMDEBUG__)
  35. #if defined(MEM_WHERE)
  36. #define malloc(a)        mem_alloc((a),__FILE__,__LINE__)
  37. #define realloc(a,b)    mem_realloc((a),(b),__FILE__,__LINE__)
  38. #define free(a)            mem_free((a),__FILE__,__LINE__)
  39. #define strdup(a)        mem_strdup((a),__FILE__,__LINE__)
  40. #else
  41. #define malloc(a)        mem_alloc(a)
  42. #define realloc(a,b)    mem_realloc((a),(b))
  43. #define free(a)            mem_free(a)
  44. #define strdup(a)        mem_strdup(a)
  45. #endif
  46. #endif
  47.