diff options
Diffstat (limited to 'src/libc/nano-mallocr.c')
-rw-r--r-- | src/libc/nano-mallocr.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libc/nano-mallocr.c b/src/libc/nano-mallocr.c index 4b69b6d4..b5c3c1c4 100644 --- a/src/libc/nano-mallocr.c +++ b/src/libc/nano-mallocr.c @@ -32,9 +32,13 @@ * Interface documentation refer to malloc.c. */ +#if 0 // DC we don't want to pull in stdio #include <stdio.h> +#endif #include <string.h> +#if 0 // DC we don't want to pull in errno because it pulls in the reent struct #include <errno.h> +#endif #include <malloc.h> #if 1 // DC @@ -57,6 +61,7 @@ #include <assert.h> #else #define assert(x) ((void)0) +#include <stdint.h> extern void vAssertCalled(uint32_t line, const char *file) noexcept; #endif @@ -116,9 +121,9 @@ extern void ReleaseMallocMutex(); #else #define MALLOC_LOCK #define MALLOC_UNLOCK -#endif #define RERRNO errno +#endif #define nano_malloc malloc #define nano_free free @@ -279,7 +284,9 @@ void * nano_malloc(RARG malloc_size_t s) if (alloc_size >= MAX_ALLOC_SIZE || alloc_size < s) { +#if 0 // DC RERRNO = ENOMEM; +#endif return NULL; } @@ -328,7 +335,9 @@ void * nano_malloc(RARG malloc_size_t s) /* sbrk returns -1 if fail to allocate */ if (r == (void *)-1) { +#if 0 // DC RERRNO = ENOMEM; +#endif MALLOC_UNLOCK; return NULL; } |