mem_std.c 694 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * 2014-08-03 bernard Add file header.
  8. */
  9. #include "rtthread.h"
  10. #ifdef RT_USING_HEAP
  11. #ifdef __CC_ARM
  12. /* avoid the heap and heap-using library functions supplied by arm */
  13. #pragma import(__use_no_heap)
  14. #endif
  15. void *malloc(size_t n)
  16. {
  17. return rt_malloc(n);
  18. }
  19. RTM_EXPORT(malloc);
  20. void *realloc(void *rmem, size_t newsize)
  21. {
  22. return rt_realloc(rmem, newsize);
  23. }
  24. RTM_EXPORT(realloc);
  25. void *calloc(size_t nelem, size_t elsize)
  26. {
  27. return rt_calloc(nelem, elsize);
  28. }
  29. RTM_EXPORT(calloc);
  30. void free(void *rmem)
  31. {
  32. rt_free(rmem);
  33. }
  34. RTM_EXPORT(free);
  35. #endif