diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c index 8d6ca5ce0..4a2f4680e 100644 --- a/newlib/libc/stdlib/nano-mallocr.c +++ b/newlib/libc/stdlib/nano-mallocr.c @@ -46,6 +46,8 @@ #define MAX(a,b) ((a) >= (b) ? (a) : (b)) #endif +#define _SBRK_R(X) _sbrk_r(X) + #ifdef INTERNAL_NEWLIB #include @@ -209,9 +211,9 @@ static void* sbrk_aligned(RARG malloc_size_t s) { char *p, *align_p; - if (sbrk_start == NULL) sbrk_start = _sbrk_r(RCALL 0); + if (sbrk_start == NULL) sbrk_start = _SBRK_R(RCALL 0); - p = _sbrk_r(RCALL s); + p = _SBRK_R(RCALL s); /* sbrk returns -1 if fail to allocate */ if (p == (void *)-1) @@ -222,7 +224,7 @@ static void* sbrk_aligned(RARG malloc_size_t s) { /* p is not aligned, ask for a few more bytes so that we have s * bytes reserved from align_p. */ - p = _sbrk_r(RCALL align_p - p); + p = _SBRK_R(RCALL align_p - p); if (p == (void *)-1) return p; } @@ -486,7 +488,7 @@ struct mallinfo nano_mallinfo(RONEARG) if (sbrk_start == NULL) total_size = 0; else { - sbrk_now = _sbrk_r(RCALL 0); + sbrk_now = _SBRK_R(RCALL 0); if (sbrk_now == (void *)-1) total_size = (size_t)-1;