mem_std.c 947 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * File : mem_std.c
  3. * Brief : implement standard memory routins.
  4. *
  5. * This file is part of Device File System in RT-Thread RTOS
  6. * COPYRIGHT (C) 2014, RT-Thread Development Team
  7. *
  8. * The license and distribution terms for this file may be
  9. * found in the file LICENSE in this distribution or at
  10. * http://www.rt-thread.org/license/LICENSE.
  11. *
  12. * Change Logs:
  13. * 2014-08-03 bernard Add file header.
  14. */
  15. #include "rtthread.h"
  16. #ifdef RT_USING_HEAP
  17. #ifdef __CC_ARM
  18. /* avoid the heap and heap-using library functions supplied by arm */
  19. #pragma import(__use_no_heap)
  20. #endif
  21. void *malloc(size_t n)
  22. {
  23. return rt_malloc(n);
  24. }
  25. RTM_EXPORT(malloc);
  26. void *realloc(void *rmem, size_t newsize)
  27. {
  28. return rt_realloc(rmem, newsize);
  29. }
  30. RTM_EXPORT(realloc);
  31. void *calloc(size_t nelem, size_t elsize)
  32. {
  33. return rt_calloc(nelem, elsize);
  34. }
  35. RTM_EXPORT(calloc);
  36. void free(void *rmem)
  37. {
  38. rt_free(rmem);
  39. }
  40. RTM_EXPORT(free);
  41. #endif