Fixed "linked" strings incorrectly marked as "owned" (fixes #1318)

This commit is contained in:
Benoit Blanchon
2020-07-24 22:25:56 +02:00
parent 6dc36125c2
commit 4df29fbac1
9 changed files with 75 additions and 74 deletions

View File

@@ -30,7 +30,7 @@ template <typename TAdaptedString>
inline bool slotSetKey(VariantSlot* var, TAdaptedString key, MemoryPool*,
storage_policies::store_by_address) {
ARDUINOJSON_ASSERT(var);
var->setLinkedKey(make_not_null(key.data()));
var->setKey(key.data(), storage_policies::store_by_address());
return true;
}
@@ -41,7 +41,7 @@ inline bool slotSetKey(VariantSlot* var, TAdaptedString key, MemoryPool* pool,
if (!dup)
return false;
ARDUINOJSON_ASSERT(var);
var->setOwnedKey(make_not_null(dup));
var->setKey(dup, storage_policies::store_by_copy());
return true;
}