diff --git a/inc/stdlib.h b/inc/stdlib.h index c6d981d..9969bfa 100644 --- a/inc/stdlib.h +++ b/inc/stdlib.h @@ -16,12 +16,15 @@ #endif +#ifdef _RTLIBC_MALLOC_ + void malloc_init(void *heap, size_t size, size_t alignment); size_t msize(void *p); void* malloc(size_t size); void free(void *p); +#endif uint64_t strtoul(const char *str, char **endptr, int32_t base); int64_t strtol(const char *str, char **endptr, int32_t base); diff --git a/src/stdlib.c b/src/stdlib.c index 06ac18d..32f5e1f 100644 --- a/src/stdlib.c +++ b/src/stdlib.c @@ -282,6 +282,8 @@ +#ifdef _RTLIBC_MALLOC_ + static rtmalloc_context_t l_malloc_context; __attribute__((weak)) void rtlibc_malloc_failed_handler(void) @@ -317,3 +319,5 @@ assert(p); return rtmsize(&l_malloc_context, p); } + +#endif