Commit dfa7d414f56d08b68cbf72023c9cceb0c9e5a6d9
Committed by
Jay Berkenbilt
1 parent
cb4debe7
Refactor JSON::writeClose
Showing
1 changed file
with
6 additions
and
4 deletions
libqpdf/JSON.cc
| @@ -32,11 +32,13 @@ JSON::JSON(std::shared_ptr<JSON_value> value) : | @@ -32,11 +32,13 @@ JSON::JSON(std::shared_ptr<JSON_value> value) : | ||
| 32 | void | 32 | void |
| 33 | JSON::writeClose(Pipeline* p, bool first, size_t depth, char const* delimiter) | 33 | JSON::writeClose(Pipeline* p, bool first, size_t depth, char const* delimiter) |
| 34 | { | 34 | { |
| 35 | - if (!first) { | ||
| 36 | - *p << "\n"; | ||
| 37 | - writeIndent(p, depth); | 35 | + if (first) { |
| 36 | + *p << delimiter; | ||
| 37 | + } else { | ||
| 38 | + std::string s{"\n"}; | ||
| 39 | + s.append(2 * depth, ' '); | ||
| 40 | + *p << s + delimiter; | ||
| 38 | } | 41 | } |
| 39 | - *p << delimiter; | ||
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | void | 44 | void |