malloc.h 666 B

123456789101112131415161718192021222324252627282930
  1. #ifndef __MALLOC_H
  2. #define __MALLOC_H
  3. #include <features.h>
  4. #include <sys/types.h>
  5. /*
  6. * Mini malloc allows you to use a less efficient but smaller malloc the
  7. * cost is about 100 bytes of code in free but malloc (700bytes) doesn't
  8. * have to be linked. Unfortunatly memory can only be reused if everything
  9. * above it has been freed
  10. *
  11. */
  12. extern void free __P((void *));
  13. extern void *malloc __P((size_t));
  14. extern void *realloc __P((void *, size_t));
  15. extern void *alloca __P((size_t));
  16. extern void *(*__alloca_alloc) __P((size_t));
  17. #ifdef __LIBC__
  18. #define __MINI_MALLOC__
  19. #endif
  20. #ifdef __MINI_MALLOC__
  21. #define malloc(x) ((*__alloca_alloc)(x))
  22. #endif
  23. #endif