malloc.h 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _MALLOC_H_
  2. #define _MALLOC_H_
  3. #include <stdlib.h>
  4. #if defined(GCOLLECT)
  5. #include "gc.h"
  6. #define aMalloc(n) GC_MALLOC(n)
  7. #define aCalloc(m,n) _bcalloc(m,n)
  8. #define aRealloc(p,n) GC_REALLOC(p,n)
  9. extern void * _bcalloc(size_t, size_t);
  10. #elif defined(BCHECK)
  11. #define aMalloc(n) malloc(n)
  12. #define aCalloc(m,n) calloc(m,n)
  13. #define aRealloc(p,n) realloc(p,n)
  14. #else
  15. #if __STDC_VERSION__ < 199901L
  16. # if __GNUC__ >= 2
  17. # define __func__ __FUNCTION__
  18. # else
  19. # define __func__ ""
  20. # endif
  21. #endif
  22. #define ALC_MARK __FILE__, __LINE__, __func__
  23. void* aMalloc_( size_t size, const char *file, int line, const char *func );
  24. void* aCalloc_( size_t num, size_t size, const char *file, int line, const char *func );
  25. void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func );
  26. #define aMalloc(n) aMalloc_(n,ALC_MARK)
  27. #define aCalloc(m,n) aCalloc_(m,n,ALC_MARK)
  28. #define aRealloc(p,n) aRealloc_(p,n,ALC_MARK)
  29. #endif
  30. #endif