Remove the zero-copy mode

After removing the string size from `VariantContent`, `deserializeJson()` and `deserializeMsgPack()` could not support NUL in strings in the zero-copy mode anymore.
Instead of adding a complicated warning in the documentation, I thought it was better to remove the zero-copy mode entirely.
The zero-copy mode has always been a source of bugs because many users used it without realizing it.
Also, the memory savings are smaller now that we deduplicate strings, so this feature should not be missed much.
This commit is contained in:
Benoit Blanchon
2023-05-10 09:55:21 +02:00
parent 9321f8fdab
commit 37357086e2
5 changed files with 6 additions and 68 deletions

View File

@ -154,12 +154,6 @@ TEST_CASE("String allocation fails") {
REQUIRE(spyingAllocator.log() ==
AllocatorLog() << AllocatorLog::AllocateFail(sizeofString(31)));
}
SECTION("Input is const char*") {
char hello[] = "\"hello\"";
REQUIRE(deserializeJson(doc, hello) == DeserializationError::Ok);
REQUIRE(spyingAllocator.log() == AllocatorLog());
}
}
TEST_CASE("Deduplicate values") {