rt-thread-official/bsp/gd32vf103v-eval/libraries/n22/stubs/sbrk.c

20 lines
374 B
C
Raw Normal View History

2019-07-24 17:03:26 +08:00
/* See LICENSE of license details. */
#include <stddef.h>
void *_sbrk(ptrdiff_t incr) {
extern char _end[];
static char *curbrk = _end;
#ifndef __ANDES__
extern char _heap_end[];
if ((curbrk + incr < _end) || (curbrk + incr > _heap_end))
#else
if ((curbrk + incr < _end) )
#endif
return NULL - 1;
curbrk += incr;
return curbrk - incr;
}