forked from bblanchon/ArduinoJson
Tests: add SpyingAllocator::clearLog()
This commit is contained in:
@ -120,6 +120,7 @@ class SpyingAllocator : public ArduinoJson::Allocator {
|
|||||||
_upstream->reallocate(block, sizeof(AllocatedBlock) + n - 1));
|
_upstream->reallocate(block, sizeof(AllocatedBlock) + n - 1));
|
||||||
if (block) {
|
if (block) {
|
||||||
_log << AllocatorLog::Reallocate(oldSize, n);
|
_log << AllocatorLog::Reallocate(oldSize, n);
|
||||||
|
ARDUINOJSON_ASSERT(block->size == oldSize);
|
||||||
block->size = n;
|
block->size = n;
|
||||||
return block->payload;
|
return block->payload;
|
||||||
} else {
|
} else {
|
||||||
@ -128,6 +129,10 @@ class SpyingAllocator : public ArduinoJson::Allocator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearLog() {
|
||||||
|
_log = AllocatorLog();
|
||||||
|
}
|
||||||
|
|
||||||
const AllocatorLog& log() const {
|
const AllocatorLog& log() const {
|
||||||
return _log;
|
return _log;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user