aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/JSON.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-01-28 12:09:46 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2023-01-28 20:49:32 +0100
commitdfa7d414f56d08b68cbf72023c9cceb0c9e5a6d9 (patch)
tree6df6eb4337b3e63ed5930500c4829e43cee7d54a /libqpdf/JSON.cc
parentcb4debe75f114da5402d7a38eaf59d1d3d42dfd4 (diff)
downloadqpdf-dfa7d414f56d08b68cbf72023c9cceb0c9e5a6d9.tar.zst
Refactor JSON::writeClose
Diffstat (limited to 'libqpdf/JSON.cc')
-rw-r--r--libqpdf/JSON.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/libqpdf/JSON.cc b/libqpdf/JSON.cc
index fba60267..7bdf01d4 100644
--- a/libqpdf/JSON.cc
+++ b/libqpdf/JSON.cc
@@ -32,11 +32,13 @@ JSON::JSON(std::shared_ptr<JSON_value> value) :
void
JSON::writeClose(Pipeline* p, bool first, size_t depth, char const* delimiter)
{
- if (!first) {
- *p << "\n";
- writeIndent(p, depth);
+ if (first) {
+ *p << delimiter;
+ } else {
+ std::string s{"\n"};
+ s.append(2 * depth, ' ');
+ *p << s + delimiter;
}
- *p << delimiter;
}
void