Browse Source

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

c415-sdk
bugobliterator 5 years ago committed by Andrew Tridgell
parent
commit
afea703aaf
  1. 4
      libraries/AP_HAL/AP_HAL_Boards.h
  2. 4
      libraries/AP_HAL/Util.h

4
libraries/AP_HAL/AP_HAL_Boards.h

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

4
libraries/AP_HAL/Util.h

@ -159,7 +159,11 @@ public: @@ -159,7 +159,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

Loading…
Cancel
Save