mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-09-26 06:50:56 +02:00
Call static clear directly
Before: 9920, 8836, 9742, 12744, 10040 After: 9918, 8796, 9742, 12698, 9994 Target: 9800, 8458, 9634, 12290, 9702
This commit is contained in:
@@ -283,7 +283,7 @@ class JsonDeserializer {
|
|||||||
|
|
||||||
stringBuilder_.save(keyVariant);
|
stringBuilder_.save(keyVariant);
|
||||||
} else {
|
} else {
|
||||||
VariantImpl(member, resources_).clear();
|
VariantImpl::clear(member, resources_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse value
|
// Parse value
|
||||||
|
@@ -22,7 +22,7 @@ inline Slot<VariantData> ResourceManager::allocVariant() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void ResourceManager::freeVariant(Slot<VariantData> slot) {
|
inline void ResourceManager::freeVariant(Slot<VariantData> slot) {
|
||||||
VariantImpl(slot.ptr(), this).clear();
|
VariantImpl::clear(slot.ptr(), this);
|
||||||
variantPools_.freeSlot(slot);
|
variantPools_.freeSlot(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ struct Converter<MsgPackBinary> : private detail::VariantAttorney {
|
|||||||
if (!data)
|
if (!data)
|
||||||
return;
|
return;
|
||||||
auto resources = getResourceManager(dst);
|
auto resources = getResourceManager(dst);
|
||||||
detail::VariantImpl(data, resources).clear();
|
detail::VariantImpl::clear(data, resources);
|
||||||
if (src.data()) {
|
if (src.data()) {
|
||||||
size_t headerSize = src.size() >= 0x10000 ? 5
|
size_t headerSize = src.size() >= 0x10000 ? 5
|
||||||
: src.size() >= 0x100 ? 3
|
: src.size() >= 0x100 ? 3
|
||||||
|
@@ -35,7 +35,7 @@ struct Converter<MsgPackExtension> : private detail::VariantAttorney {
|
|||||||
if (!data)
|
if (!data)
|
||||||
return;
|
return;
|
||||||
auto resources = getResourceManager(dst);
|
auto resources = getResourceManager(dst);
|
||||||
detail::VariantImpl(data, resources).clear();
|
detail::VariantImpl::clear(data, resources);
|
||||||
if (src.data()) {
|
if (src.data()) {
|
||||||
uint8_t format, sizeBytes;
|
uint8_t format, sizeBytes;
|
||||||
if (src.size() >= 0x10000) {
|
if (src.size() >= 0x10000) {
|
||||||
|
@@ -240,7 +240,7 @@ inline void convertToJson(const ::Printable& src, JsonVariant dst) {
|
|||||||
auto data = detail::VariantAttorney::getData(dst);
|
auto data = detail::VariantAttorney::getData(dst);
|
||||||
if (!resources || !data)
|
if (!resources || !data)
|
||||||
return;
|
return;
|
||||||
detail::VariantImpl(data, resources).clear();
|
detail::VariantImpl::clear(data, resources);
|
||||||
detail::StringBuilderPrint print(resources);
|
detail::StringBuilderPrint print(resources);
|
||||||
src.printTo(print);
|
src.printTo(print);
|
||||||
if (print.overflowed())
|
if (print.overflowed())
|
||||||
|
@@ -44,8 +44,8 @@ inline bool VariantImpl::setString(TAdaptedString value) {
|
|||||||
|
|
||||||
inline void VariantImpl::clear(VariantData* data_,
|
inline void VariantImpl::clear(VariantData* data_,
|
||||||
ResourceManager* resources_) {
|
ResourceManager* resources_) {
|
||||||
if (!data_)
|
ARDUINOJSON_ASSERT(data_ != nullptr);
|
||||||
return;
|
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||||
|
|
||||||
if (data_->type & VariantTypeBits::OwnedStringBit)
|
if (data_->type & VariantTypeBits::OwnedStringBit)
|
||||||
resources_->dereferenceString(data_->content.asStringNode->data);
|
resources_->dereferenceString(data_->content.asStringNode->data);
|
||||||
@@ -62,7 +62,8 @@ inline void VariantImpl::clear(VariantData* data_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void VariantImpl::clear() {
|
inline void VariantImpl::clear() {
|
||||||
clear(data_, resources_);
|
if (data_)
|
||||||
|
clear(data_, resources_);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ARDUINOJSON_USE_8_BYTE_POOL
|
#if ARDUINOJSON_USE_8_BYTE_POOL
|
||||||
|
Reference in New Issue
Block a user