mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Added BasicJsonDocument::shrinkToFit()
This commit is contained in:
@@ -103,7 +103,7 @@ class VariantData {
|
||||
|
||||
bool equals(const VariantData &other) const {
|
||||
// Check that variant have the same type, but ignore string ownership
|
||||
if ((type() | OWNERSHIP_BIT) != (other.type() | OWNERSHIP_BIT))
|
||||
if ((type() | VALUE_IS_OWNED) != (other.type() | VALUE_IS_OWNED))
|
||||
return false;
|
||||
|
||||
switch (type()) {
|
||||
@@ -352,6 +352,12 @@ class VariantData {
|
||||
return _content.asCollection.add(key, pool);
|
||||
}
|
||||
|
||||
void movePointers(ptrdiff_t stringDistance, ptrdiff_t variantDistance) {
|
||||
if (_flags & VALUE_IS_OWNED) _content.asString += stringDistance;
|
||||
if (_flags & COLLECTION_MASK)
|
||||
_content.asCollection.movePointers(stringDistance, variantDistance);
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t type() const {
|
||||
return _flags & VALUE_MASK;
|
||||
|
||||
Reference in New Issue
Block a user