mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-09-25 22:40:56 +02:00
Extract toArray()
Before: 9894, 8796, 9708, 12674, 9970 After: 9884, 8796, 9702, 12668, 9964 Target: 9800, 8458, 9634, 12290, 9702
This commit is contained in:
@@ -71,7 +71,7 @@ class JsonDeserializer {
|
||||
switch (current()) {
|
||||
case '[':
|
||||
if (filter.allowArray())
|
||||
return parseArray(VariantImpl(variant, resources_).toArray(), filter,
|
||||
return parseArray(VariantImpl::toArray(variant, resources_), filter,
|
||||
nestingLimit);
|
||||
else
|
||||
return skipArray(nestingLimit);
|
||||
|
@@ -352,7 +352,7 @@ class MsgPackDeserializer {
|
||||
ArrayImpl array;
|
||||
if (allowArray) {
|
||||
ARDUINOJSON_ASSERT(variant != 0);
|
||||
array = VariantImpl(variant, resources_).toArray();
|
||||
array = VariantImpl::toArray(variant, resources_);
|
||||
}
|
||||
|
||||
TFilter elementFilter = filter[0U];
|
||||
|
@@ -478,9 +478,15 @@ class VariantImpl {
|
||||
}
|
||||
|
||||
ArrayImpl toArray() {
|
||||
ARDUINOJSON_ASSERT(type() == VariantType::Null); // must call clear() first
|
||||
if (!data_)
|
||||
return ArrayImpl();
|
||||
return toArray(data_, resources_);
|
||||
}
|
||||
|
||||
static ArrayImpl toArray(VariantData* data_, ResourceManager* resources_) {
|
||||
ARDUINOJSON_ASSERT(data_ != nullptr);
|
||||
ARDUINOJSON_ASSERT(data_->type == VariantType::Null);
|
||||
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||
data_->type = VariantType::Array;
|
||||
return ArrayImpl(new (&data_->content.asCollection) CollectionData(),
|
||||
resources_);
|
||||
|
Reference in New Issue
Block a user