[patch iproute2] jsonw: Fix indentation of ending "}"

Subsystems: library code, the rest

STALE3702d

3 messages, 2 authors, 2016-07-21 · open the first message on its own page

[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

Re: [patch iproute2] jsonw: Fix indentation of ending "}"

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2016-07-20 19:19:38

On Mon, 18 Jul 2016 09:51:17 +0200
Jiri Pirko [off-list ref] wrote:
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>
This no longer applies, put in change to json_writer for bridge formatting.
Is it still needed?

Re: [patch iproute2] jsonw: Fix indentation of ending "}"

From: Jiri Pirko <jiri@resnulli.us>
Date: 2016-07-21 09:38:15

Wed, Jul 20, 2016 at 09:19:24PM CEST, stephen@networkplumber.org wrote:
On Mon, 18 Jul 2016 09:51:17 +0200
Jiri Pirko [off-list ref] wrote:
quoted
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>
This no longer applies, put in change to json_writer for bridge formatting.
Is it still needed?
Looks like this is fixed now in master. Please drop this. Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help