Firmwares/hifive1-vp/hello/bsp/libwrap/sys/sbrk.c
2023-08-20 15:00:51 +02:00

17 lines
303 B
C

/* See LICENSE of license details. */
#include <stddef.h>
void *__wrap_sbrk(ptrdiff_t incr)
{
extern char _end[];
extern char _heap_end[];
static char *curbrk = _end;
if ((curbrk + incr < _end) || (curbrk + incr > _heap_end))
return NULL - 1;
curbrk += incr;
return curbrk - incr;
}