[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 18 Jul 2016 09:51:17 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org, Jiri Pirko <jiri@...lanox.com>
Subject: [patch iproute2] jsonw: Fix indentation of ending "}"
From: Jiri Pirko <jiri@...lanox.com>
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 <jiri@...lanox.com>
---
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
Powered by blists - more mailing lists