compat.c 884 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "cc.h"
  10. #include "compat"
  11. /*
  12. * fake mallocs
  13. */
  14. void*
  15. malloc(uint32_t n)
  16. {
  17. return alloc(n);
  18. }
  19. void*
  20. calloc(uint32_t m, uint32_t n)
  21. {
  22. return alloc(m*n);
  23. }
  24. void*
  25. realloc(void*, uint32_t)
  26. {
  27. fprint(2, "realloc called\n");
  28. abort();
  29. return 0;
  30. }
  31. void
  32. free(void*)
  33. {
  34. }
  35. /* needed when profiling */
  36. void*
  37. mallocz(uint32_t size, int clr)
  38. {
  39. void *v;
  40. v = alloc(size);
  41. if(clr && v != nil)
  42. memset(v, 0, size);
  43. return v;
  44. }
  45. void
  46. setmalloctag(void*, uint32_t)
  47. {
  48. }