forked from bblanchon/ArduinoJson
Added StaticJsonDocument::garbageCollect()
This commit is contained in:
1 parent
0853b04589
commit
735bea1f47
4 files changed
+19
-1
No files matched your search
@@ -120,7 +120,7 @@ class BasicJsonDocument : AllocatorOwner<TAllocator>, public JsonDocument {
|
||||
|
||||
bool garbageCollect() {
|
||||
// make a temporary clone and move assign
|
||||
BasicJsonDocument<TAllocator> tmp(*this);
|
||||
BasicJsonDocument tmp(*this);
|
||||
if (!tmp.capacity())
|
||||
return false;
|
||||
tmp.set(*this);
|
||||
|
||||
@@ -44,6 +44,11 @@ class StaticJsonDocument : public JsonDocument {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void garbageCollect() {
|
||||
StaticJsonDocument tmp(*this);
|
||||
set(tmp);
|
||||
}
|
||||
|
||||
private:
|
||||
char _buffer[_capacity];
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user