JsonArray::remove() and JsonObject::remove() now release the memory of strings

This commit is contained in:
Benoit Blanchon
2018-11-09 17:27:32 +01:00
parent e842838a23
commit f375459d53
68 changed files with 1504 additions and 740 deletions

View File

@@ -11,7 +11,7 @@ namespace ARDUINOJSON_NAMESPACE {
class ZeroTerminatedRamStringConst {
public:
ZeroTerminatedRamStringConst(const char* str) : _str(str) {}
ZeroTerminatedRamStringConst(const char* str = 0) : _str(str) {}
bool equals(const char* expected) const {
const char* actual = _str;
@@ -23,15 +23,19 @@ class ZeroTerminatedRamStringConst {
return !_str;
}
template <typename TMemoryPool>
const char* save(TMemoryPool*) const {
return _str;
}
// template <typename TMemoryPool>
// const char* save(TMemoryPool*) const {
// return _str;
// }
size_t size() const {
return strlen(_str);
}
const char* c_str() const {
return _str;
}
protected:
const char* _str;
};