mem_std.c 714 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #include <stddef.h>
  11. #ifdef RT_USING_HEAP
  12. #ifdef __CC_ARM
  13. /* avoid the heap and heap-using library functions supplied by arm */
  14. #pragma import(__use_no_heap)
  15. #endif
  16. void *malloc(size_t n)
  17. {
  18. return rt_malloc(n);
  19. }
  20. RTM_EXPORT(malloc);
  21. void *realloc(void *rmem, size_t newsize)
  22. {
  23. return rt_realloc(rmem, newsize);
  24. }
  25. RTM_EXPORT(realloc);
  26. void *calloc(size_t nelem, size_t elsize)
  27. {
  28. return rt_calloc(nelem, elsize);
  29. }
  30. RTM_EXPORT(calloc);
  31. void free(void *rmem)
  32. {
  33. rt_free(rmem);
  34. }
  35. RTM_EXPORT(free);
  36. #endif