mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 18:27:37 +02:00
Hide FreeSlot
in MemoryPoolList
This commit is contained in:
@ -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<FreeSlot*>(slot)->next;
|
||||
return {slot, id};
|
||||
}
|
||||
|
||||
inline void MemoryPoolList::freeSlot(SlotWithId slot) {
|
||||
slot->free.next = freeList_;
|
||||
reinterpret_cast<FreeSlot*>(slot.slot())->next = freeList_;
|
||||
freeList_ = slot.id();
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,10 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
|
||||
using PoolCount = SlotId;
|
||||
|
||||
class MemoryPoolList {
|
||||
struct FreeSlot {
|
||||
SlotId next;
|
||||
};
|
||||
|
||||
public:
|
||||
MemoryPoolList() = default;
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user