AP_HAL: ensure libc realloc is available for all platforms except ChibiOS

This commit is contained in:
bugobliterator 2020-03-17 14:17:38 +05:30 committed by Randy Mackay
parent f163448298
commit cf0c6d3247
2 changed files with 8 additions and 0 deletions

View File

@ -232,3 +232,7 @@
#else
#define AP_UAVCAN_SLCAN_ENABLED 0
#endif
#ifndef USE_LIBC_REALLOC
#define USE_LIBC_REALLOC 1
#endif

View File

@ -151,7 +151,11 @@ public:
// heap functions, note that a heap once alloc'd cannot be dealloc'd
virtual void *allocate_heap_memory(size_t size) = 0;
virtual void *heap_realloc(void *heap, void *ptr, size_t new_size) = 0;
#if USE_LIBC_REALLOC
virtual void *std_realloc(void *ptr, size_t new_size) { return realloc(ptr, new_size); }
#else
virtual void *std_realloc(void *ptr, size_t new_size) = 0;
#endif // USE_LIBC_REALLOC
#endif // ENABLE_HEAP