[patch iproute2] jsonw: Fix indentation of ending "}"
From: Jiri Pirko <jiri@resnulli.us>
Date: 2016-07-18 07:51:21
From: Jiri Pirko <redacted>
Fix indentation of the very last "}" which is currently indented,
leaving the last 2 "}" like this:
\t}
\t}
EOF
So fix it to be:
\t}
}
EOF
Fixes fcc16c2287 ("provide common json output formatter")
Signed-off-by: Jiri Pirko <redacted>
---
lib/json_writer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/json_writer.c b/lib/json_writer.c
index 2af16e1..4c0f646 100644
--- a/lib/json_writer.c
+++ b/lib/json_writer.c@@ -33,7 +33,7 @@ struct json_writer { static void jsonw_indent(json_writer_t *self) { unsigned i; - for (i = 0; i <= self->depth; ++i) + for (i = 0; i < self->depth; ++i) fputs(" ", self->out); }
@@ -103,6 +103,7 @@ json_writer_t *jsonw_new(FILE *f) self->pretty = false; self->sep = '\0'; putc('{', self->out); + ++self->depth; } return self; }
@@ -112,6 +113,7 @@ void jsonw_destroy(json_writer_t **self_p) { json_writer_t *self = *self_p; + --self->depth; assert(self->depth == 0); jsonw_eol(self); fputs("}\n", self->out);
--
2.5.5