mem_std.c 923 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. /* avoid the heap and heap-using library functions supplied by arm */
  18. #pragma import(__use_no_heap)
  19. void *malloc(size_t n)
  20. {
  21. return rt_malloc(n);
  22. }
  23. RTM_EXPORT(malloc);
  24. void *realloc(void *rmem, size_t newsize)
  25. {
  26. return rt_realloc(rmem, newsize);
  27. }
  28. RTM_EXPORT(realloc);
  29. void *calloc(size_t nelem, size_t elsize)
  30. {
  31. return rt_calloc(nelem, elsize);
  32. }
  33. RTM_EXPORT(calloc);
  34. void free(void *rmem)
  35. {
  36. rt_free(rmem);
  37. }
  38. RTM_EXPORT(free);
  39. #endif