mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-30 02:37:35 +02:00
Hide FreeSlot
in MemoryPoolList
This commit is contained in:
@ -69,12 +69,12 @@ inline SlotWithId MemoryPoolList::allocFromFreeList() {
|
|||||||
ARDUINOJSON_ASSERT(freeList_ != NULL_SLOT);
|
ARDUINOJSON_ASSERT(freeList_ != NULL_SLOT);
|
||||||
auto id = freeList_;
|
auto id = freeList_;
|
||||||
auto slot = getSlot(freeList_);
|
auto slot = getSlot(freeList_);
|
||||||
freeList_ = slot->free.next;
|
freeList_ = reinterpret_cast<FreeSlot*>(slot)->next;
|
||||||
return {slot, id};
|
return {slot, id};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MemoryPoolList::freeSlot(SlotWithId slot) {
|
inline void MemoryPoolList::freeSlot(SlotWithId slot) {
|
||||||
slot->free.next = freeList_;
|
reinterpret_cast<FreeSlot*>(slot.slot())->next = freeList_;
|
||||||
freeList_ = slot.id();
|
freeList_ = slot.id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,10 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
|
|||||||
using PoolCount = SlotId;
|
using PoolCount = SlotId;
|
||||||
|
|
||||||
class MemoryPoolList {
|
class MemoryPoolList {
|
||||||
|
struct FreeSlot {
|
||||||
|
SlotId next;
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MemoryPoolList() = default;
|
MemoryPoolList() = default;
|
||||||
|
|
||||||
|
@ -13,15 +13,10 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
|
|||||||
|
|
||||||
struct StringNode;
|
struct StringNode;
|
||||||
|
|
||||||
struct FreeSlot {
|
|
||||||
SlotId next;
|
|
||||||
};
|
|
||||||
|
|
||||||
union VariantSlot {
|
union VariantSlot {
|
||||||
VariantSlot() {}
|
VariantSlot() {}
|
||||||
|
|
||||||
VariantData variant;
|
VariantData variant;
|
||||||
FreeSlot free;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ARDUINOJSON_END_PRIVATE_NAMESPACE
|
ARDUINOJSON_END_PRIVATE_NAMESPACE
|
||||||
|
Reference in New Issue
Block a user