chore: update jsoncons version to 0.178 (#4368)

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2025-01-08 20:05:50 +02:00 committed by GitHub
parent 5adb976207
commit f3426bd559
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 44 deletions

View file

@ -878,6 +878,9 @@ void CompactObj::SetJson(JsonType&& j) {
if (taglen_ == JSON_TAG && JsonEnconding() == kEncodingJsonCons) {
DCHECK(u_.json_obj.cons.json_ptr != nullptr); // must be allocated
u_.json_obj.cons.json_ptr->swap(j);
DCHECK(jsoncons::is_trivial_storage(u_.json_obj.cons.json_ptr->storage_kind()) ||
u_.json_obj.cons.json_ptr->get_allocator().resource() == tl.local_mr);
// We do not set bytes_used as this is needed. Consider the two following cases:
// 1. old json contains 50 bytes. The delta for new one is 50, so the total bytes
// the new json occupies is 100.
@ -889,6 +892,10 @@ void CompactObj::SetJson(JsonType&& j) {
SetMeta(JSON_TAG);
u_.json_obj.cons.json_ptr = AllocateMR<JsonType>(std::move(j));
// With trivial storage json_ptr->get_allocator() throws an exception.
DCHECK(jsoncons::is_trivial_storage(u_.json_obj.cons.json_ptr->storage_kind()) ||
u_.json_obj.cons.json_ptr->get_allocator().resource() == tl.local_mr);
u_.json_obj.cons.bytes_used = 0;
}