Skip to content

Commit 03bca2a

Browse files
committed
Drop extra newlines on empty mdb
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
1 parent 0146378 commit 03bca2a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/bridge.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ int show_bridge_groups(FILE *fp)
653653
}
654654

655655
if (json) {
656-
fprintf(fp, "[\n");
656+
fprintf(fp, "[");
657657
prefix += 2;
658658
}
659659
else
@@ -674,7 +674,7 @@ int show_bridge_groups(FILE *fp)
674674
snprintf(vid, sizeof(vid), "%4s", "");
675675

676676
if (json) {
677-
fprintf(fp, "%s%*s{\n", first ? "" : ",\n", prefix, "");
677+
fprintf(fp, "%s%*s{\n", first ? "\n" : ",\n", prefix, "");
678678
prefix += 2;
679679
first = 0;
680680

@@ -692,7 +692,10 @@ int show_bridge_groups(FILE *fp)
692692

693693
if (json) {
694694
prefix -= 2;
695-
fprintf(fp, "\n%*s]\n", prefix, "");
695+
if (first)
696+
fprintf(fp, "]\n");
697+
else
698+
fprintf(fp, "%*s]\n", prefix, "");
696699
}
697700

698701
drop();

0 commit comments

Comments
 (0)