diff --git a/components/libc/minilibc/stdlib.c b/components/libc/minilibc/stdlib.c index 7c14036351..b5c3206e28 100644 --- a/components/libc/minilibc/stdlib.c +++ b/components/libc/minilibc/stdlib.c @@ -38,4 +38,24 @@ int atoi(const char* s) return sign==-1?-v:v; } +void *malloc(size_t size) +{ + return rt_malloc(size); +} + +void free(void *ptr) +{ + rt_free(ptr); +} + +void *realloc(void *ptr, size_t size) +{ + return rt_realloc(ptr, size); +} + +void *calloc(size_t nelem, size_t elsize) +{ + return rt_calloc(nelem, elsize); +} + #endif diff --git a/components/libc/minilibc/stdlib.h b/components/libc/minilibc/stdlib.h index e91a176089..9b87743242 100644 --- a/components/libc/minilibc/stdlib.h +++ b/components/libc/minilibc/stdlib.h @@ -19,12 +19,6 @@ #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) int atoi(const char *nptr); -#endif - -#define malloc rt_malloc -#define free rt_free -#define realloc rt_realloc -#define calloc rt_calloc int rand(void); int rand_r(unsigned int *seed); @@ -32,4 +26,10 @@ void srand(unsigned int seed); void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); +void *malloc(size_t size); +void free(void *ptr); +void *realloc(void *ptr, size_t size); +void *calloc(size_t nelem, size_t elsize); +#endif + #endif