[feat][bsp_common/platform] complete calloc function that float print needs

This commit is contained in:
jzlv 2021-10-19 20:06:47 +08:00
parent 626c6f3fae
commit 31564a9bdd

View file

@ -232,14 +232,19 @@ void *_realloc_r(struct _reent *ptr, void *old, size_t newlen)
if (result == NULL) {
ptr->_errno = -ENOMEM;
}
return result;
}
void *_calloc_r(struct _reent *ptr, size_t size, size_t len)
{
/* return "not supported" */
return 0;
void *result;
result = (void *)mmheap_calloc(&mmheap_root, size, len);
if (result == NULL) {
ptr->_errno = -ENOMEM;
}
return result;
}
void _free_r(struct _reent *ptr, void *addr)
@ -249,7 +254,11 @@ void _free_r(struct _reent *ptr, void *addr)
void *_sbrk_r(struct _reent *ptr, ptrdiff_t incr)
{
return 0;
void *ret;
ptr->_errno = ENOMEM;
ret = (void *)-1;
return ret;
}
/* for exit() and abort() */