diff --git a/src/ArduinoJson/Memory/MemoryPoolImpl.hpp b/src/ArduinoJson/Memory/MemoryPoolImpl.hpp index 2046aa55..a8dbdf4c 100644 --- a/src/ArduinoJson/Memory/MemoryPoolImpl.hpp +++ b/src/ArduinoJson/Memory/MemoryPoolImpl.hpp @@ -69,12 +69,12 @@ inline SlotWithId MemoryPoolList::allocFromFreeList() { ARDUINOJSON_ASSERT(freeList_ != NULL_SLOT); auto id = freeList_; auto slot = getSlot(freeList_); - freeList_ = slot->free.next; + freeList_ = reinterpret_cast(slot)->next; return {slot, id}; } inline void MemoryPoolList::freeSlot(SlotWithId slot) { - slot->free.next = freeList_; + reinterpret_cast(slot.slot())->next = freeList_; freeList_ = slot.id(); } diff --git a/src/ArduinoJson/Memory/MemoryPoolList.hpp b/src/ArduinoJson/Memory/MemoryPoolList.hpp index b87b047f..b2eae0da 100644 --- a/src/ArduinoJson/Memory/MemoryPoolList.hpp +++ b/src/ArduinoJson/Memory/MemoryPoolList.hpp @@ -15,6 +15,10 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE using PoolCount = SlotId; class MemoryPoolList { + struct FreeSlot { + SlotId next; + }; + public: MemoryPoolList() = default; diff --git a/src/ArduinoJson/Variant/VariantSlot.hpp b/src/ArduinoJson/Variant/VariantSlot.hpp index cdbd8863..efde6583 100644 --- a/src/ArduinoJson/Variant/VariantSlot.hpp +++ b/src/ArduinoJson/Variant/VariantSlot.hpp @@ -13,15 +13,10 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE struct StringNode; -struct FreeSlot { - SlotId next; -}; - union VariantSlot { VariantSlot() {} VariantData variant; - FreeSlot free; }; ARDUINOJSON_END_PRIVATE_NAMESPACE