Browse Source

[libc] fix compilation error when RT_USING_HEAP is disable

liang yongxiang 6 năm trước cách đây
mục cha
commit
b822ac8ff6

+ 2 - 0
components/libc/compilers/armlibc/mem_std.c

@@ -15,6 +15,7 @@
 
 
 #include "rtthread.h"
 #include "rtthread.h"
 
 
+#ifdef RT_USING_HEAP
 /* avoid the heap and heap-using library functions supplied by arm */
 /* avoid the heap and heap-using library functions supplied by arm */
 #pragma import(__use_no_heap)
 #pragma import(__use_no_heap)
 
 
@@ -41,3 +42,4 @@ void free(void *rmem)
     rt_free(rmem);
     rt_free(rmem);
 }
 }
 RTM_EXPORT(free);
 RTM_EXPORT(free);
+#endif

+ 2 - 0
components/libc/compilers/dlib/syscall_mem.c

@@ -23,6 +23,7 @@
  */
  */
 #include <rtthread.h>
 #include <rtthread.h>
 
 
+#ifdef RT_USING_HEAP
 void *malloc(rt_size_t n)
 void *malloc(rt_size_t n)
 {
 {
     return rt_malloc(n);
     return rt_malloc(n);
@@ -42,3 +43,4 @@ void free(void *rmem)
 {
 {
     rt_free(rmem);
     rt_free(rmem);
 }
 }
+#endif