Allow heap end to be equal to stack limit (#266)

This commit is contained in:
Mike Bell 2021-03-24 14:26:54 +00:00 committed by GitHub
parent 1d4588a565
commit a47d6d6e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,9 +175,9 @@ void *_sbrk(int incr) {
prev_heap_end = heap_end; prev_heap_end = heap_end;
char *next_heap_end = heap_end + incr; char *next_heap_end = heap_end + incr;
if (__builtin_expect(next_heap_end >= (&__StackLimit), false)) { if (__builtin_expect(next_heap_end > (&__StackLimit), false)) {
#if PICO_USE_OPTIMISTIC_SBRK #if PICO_USE_OPTIMISTIC_SBRK
if (next_heap_end == &__StackLimit) { if (heap_end == &__StackLimit) {
// errno = ENOMEM; // errno = ENOMEM;
return (char *) -1; return (char *) -1;
} }