Address the review: null inline nodes, trait spelling, and max() in json_view

- inline_nodes is null when the document has no inline nodes, instead of
  pointing past the end of the allocation; shrink_to_fit() no longer
  passes it to memcpy() for an empty node array
- is_byte_char and is_wide_char use conjunction/disjunction, which
  astyle leaves unspaced
- append_stream() uses (std::max) for the count read

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-17 08:30:48 +02:00
1 parent 99250c8275
commit 4cc906e567
4 files changed
+18 -12

No files matched your search

+4 -1
View File
@@ -443,7 +443,10 @@ class basic_json_document
if (shrink_nodes)
{
std::memcpy(fresh, d.nodes, d.node_count * sizeof(node));
if (d.node_count != 0)
{
std::memcpy(fresh, d.nodes, d.node_count * sizeof(node));
}
::operator delete (d.nodes);
d.nodes = fresh;
d.node_capacity = into_header ? d.inline_capacity : d.node_count;