[Olsr-dev] [PATCH v1 104/115] jsoninfo: helpers: minor simplification of abuf_json_new_indent
Ferry Huberts
(spam-protected)
Wed Dec 2 21:29:17 CET 2015
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
lib/jsoninfo/src/olsrd_jsoninfo_helpers.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c b/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c
index b87a0e3..a076c2e 100644
--- a/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c
+++ b/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c
@@ -61,15 +61,13 @@ static int entrynumber[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static int currentjsondepth = 0;
static void abuf_json_new_indent(struct autobuf *abuf) {
- int i = currentjsondepth;
+ if (currentjsondepth) {
+ int i = currentjsondepth;
- if (!i) {
- return;
- }
-
- abuf_puts(abuf, "\n");
- while (i-- > 0) {
- abuf_puts(abuf, " ");
+ abuf_puts(abuf, "\n");
+ while (i-- > 0) {
+ abuf_puts(abuf, " ");
+ }
}
}
--
2.5.0
More information about the Olsr-dev
mailing list