Remove unused CopiedString in MemoryPool

This commit is contained in:
Benoit Blanchon
2022-01-13 15:19:46 +01:00
parent ee12155617
commit 973858b835

View File

@ -62,12 +62,12 @@ class MemoryPool {
template <typename TAdaptedString> template <typename TAdaptedString>
const char* saveString(TAdaptedString str) { const char* saveString(TAdaptedString str) {
if (str.isNull()) if (str.isNull())
return CopiedString(); return 0;
#if ARDUINOJSON_ENABLE_STRING_DEDUPLICATION #if ARDUINOJSON_ENABLE_STRING_DEDUPLICATION
const char* existingCopy = findString(str); const char* existingCopy = findString(str);
if (existingCopy) if (existingCopy)
return CopiedString(existingCopy, str.size()); return existingCopy;
#endif #endif
size_t n = str.size(); size_t n = str.size();
@ -77,7 +77,7 @@ class MemoryPool {
stringGetChars(str, newCopy, n); stringGetChars(str, newCopy, n);
newCopy[n] = 0; // force null-terminator newCopy[n] = 0; // force null-terminator
} }
return CopiedString(newCopy, n); return newCopy;
} }
void getFreeZone(char** zoneStart, size_t* zoneSize) const { void getFreeZone(char** zoneStart, size_t* zoneSize) const {
@ -89,14 +89,14 @@ class MemoryPool {
#if ARDUINOJSON_ENABLE_STRING_DEDUPLICATION #if ARDUINOJSON_ENABLE_STRING_DEDUPLICATION
const char* dup = findString(adaptString(_left, len)); const char* dup = findString(adaptString(_left, len));
if (dup) if (dup)
return CopiedString(dup, len); return dup;
#endif #endif
const char* str = _left; const char* str = _left;
_left += len; _left += len;
*_left++ = 0; *_left++ = 0;
checkInvariants(); checkInvariants();
return CopiedString(str, len); return str;
} }
void markAsOverflowed() { void markAsOverflowed() {