mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-09-25 14:30:56 +02:00
Extract toObject()
Before: 9884, 8796, 9702, 12668, 9964 After: 9874, 8796, 9694, 12634, 9970 Target: 9800, 8458, 9634, 12290, 9702
This commit is contained in:
@@ -78,8 +78,8 @@ class JsonDeserializer {
|
||||
|
||||
case '{':
|
||||
if (filter.allowObject())
|
||||
return parseObject(VariantImpl(variant, resources_).toObject(),
|
||||
filter, nestingLimit);
|
||||
return parseObject(VariantImpl::toObject(variant, resources_), filter,
|
||||
nestingLimit);
|
||||
else
|
||||
return skipObject(nestingLimit);
|
||||
|
||||
|
@@ -388,7 +388,7 @@ class MsgPackDeserializer {
|
||||
ObjectImpl object;
|
||||
if (filter.allowObject()) {
|
||||
ARDUINOJSON_ASSERT(variant != 0);
|
||||
object = VariantImpl(variant, resources_).toObject();
|
||||
object = VariantImpl::toObject(variant, resources_);
|
||||
}
|
||||
|
||||
for (; n; --n) {
|
||||
|
@@ -493,9 +493,15 @@ class VariantImpl {
|
||||
}
|
||||
|
||||
ObjectImpl toObject() {
|
||||
ARDUINOJSON_ASSERT(type() == VariantType::Null); // must call clear() first
|
||||
if (!data_)
|
||||
return ObjectImpl();
|
||||
return toObject(data_, resources_);
|
||||
}
|
||||
|
||||
static ObjectImpl toObject(VariantData* data_, ResourceManager* resources_) {
|
||||
ARDUINOJSON_ASSERT(data_ != nullptr);
|
||||
ARDUINOJSON_ASSERT(data_->type == VariantType::Null);
|
||||
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||
data_->type = VariantType::Object;
|
||||
return ObjectImpl(new (&data_->content.asCollection) CollectionData(),
|
||||
resources_);
|
||||
|
Reference in New Issue
Block a user