alloc.h 958 B

123456789101112131415161718192021222324252627
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* PROGRAM'S INTERFACE TO MEMORY ALLOCATION ROUTINES */
  6. /* This file serves as the interface between the program and the
  7. memory allocating routines.
  8. There are 3 memory allocation routines:
  9. char *Malloc(n) allocate n bytes
  10. char *Salloc(str, n) allocate n bytes and fill them with
  11. string str
  12. char *Realloc(str, n) reallocate the string at str to n bytes,
  13. only works if str was last allocated
  14. */
  15. extern char *Salloc(), *Malloc(), *Srealloc();
  16. extern char *malloc(), *realloc();
  17. /* S T R U C T U R E - S T O R A G E D E F I N I T I O N S */
  18. #ifndef BOTCH_FREE
  19. #define st_free(ptr, phead, size) (ptr->next = *phead, *phead = ptr)
  20. #else def BOTCH_FREE
  21. #define st_free(ptr, phead, size) (botch((char *)(ptr), size), \
  22. ptr->next = *phead, *phead = ptr)
  23. #endif BOTCH_FREE