add malloc, realloc etc implementation in minilibc.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1452 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
df69843bd3
commit
b2c7d265f2
|
@ -38,4 +38,24 @@ int atoi(const char* s)
|
||||||
return sign==-1?-v:v;
|
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
|
#endif
|
||||||
|
|
|
@ -19,12 +19,6 @@
|
||||||
|
|
||||||
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
|
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
|
||||||
int atoi(const char *nptr);
|
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(void);
|
||||||
int rand_r(unsigned int *seed);
|
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 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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue