forked from bblanchon/ArduinoJson
Rename SlotWithId::slot() and VariantWithId::data() to ptr()
This commit is contained in:
@@ -25,7 +25,7 @@ inline VariantData* ArrayData::addElement(ResourceManager* resources) {
|
||||
if (!slot)
|
||||
return nullptr;
|
||||
CollectionData::appendOne(slot, resources);
|
||||
return slot.data();
|
||||
return slot.ptr();
|
||||
}
|
||||
|
||||
inline VariantData* ArrayData::getOrAddElement(size_t index,
|
||||
@@ -62,7 +62,7 @@ inline bool ArrayData::addValue(T&& value, ResourceManager* resources) {
|
||||
auto slot = resources->allocVariant();
|
||||
if (!slot)
|
||||
return false;
|
||||
JsonVariant variant(slot.data(), resources);
|
||||
JsonVariant variant(slot.ptr(), resources);
|
||||
if (!variant.set(detail::forward<T>(value))) {
|
||||
resources->freeVariant(slot);
|
||||
return false;
|
||||
|
||||
@@ -30,7 +30,7 @@ class SlotWithId {
|
||||
return id_;
|
||||
}
|
||||
|
||||
VariantData* slot() const {
|
||||
VariantData* ptr() const {
|
||||
return slot_;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ inline SlotWithId MemoryPoolList::allocFromFreeList() {
|
||||
}
|
||||
|
||||
inline void MemoryPoolList::freeSlot(SlotWithId slot) {
|
||||
reinterpret_cast<FreeSlot*>(slot.slot())->next = freeList_;
|
||||
reinterpret_cast<FreeSlot*>(slot.ptr())->next = freeList_;
|
||||
freeList_ = slot.id();
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class MemoryPoolList {
|
||||
auto slot = pools_[poolIndex].allocSlot();
|
||||
if (!slot)
|
||||
return {};
|
||||
return {slot.slot(),
|
||||
return {slot.ptr(),
|
||||
SlotId(poolIndex * ARDUINOJSON_POOL_CAPACITY + slot.id())};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ inline VariantWithId ResourceManager::allocVariant() {
|
||||
overflowed_ = true;
|
||||
return {};
|
||||
}
|
||||
return {new (p.slot()) VariantData, p.id()};
|
||||
return {new (p.ptr()) VariantData, p.id()};
|
||||
}
|
||||
|
||||
inline void ResourceManager::freeVariant(VariantWithId variant) {
|
||||
|
||||
@@ -65,7 +65,7 @@ inline VariantData* ObjectData::addMember(TAdaptedString key,
|
||||
|
||||
CollectionData::appendPair(keySlot, valueSlot, resources);
|
||||
|
||||
return valueSlot.data();
|
||||
return valueSlot.ptr();
|
||||
}
|
||||
|
||||
// Returns the size (in bytes) of an object with n members.
|
||||
|
||||
@@ -540,13 +540,13 @@ class VariantWithId : public SlotWithId {
|
||||
VariantWithId(VariantData* data, SlotId id)
|
||||
: SlotWithId(reinterpret_cast<VariantData*>(data), id) {}
|
||||
|
||||
VariantData* data() {
|
||||
return reinterpret_cast<VariantData*>(slot());
|
||||
VariantData* ptr() {
|
||||
return reinterpret_cast<VariantData*>(SlotWithId::ptr());
|
||||
}
|
||||
|
||||
VariantData* operator->() {
|
||||
ARDUINOJSON_ASSERT(data() != nullptr);
|
||||
return data();
|
||||
ARDUINOJSON_ASSERT(ptr() != nullptr);
|
||||
return ptr();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user