[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180906153057.5379-2-stephen@networkplumber.org>
Date: Thu, 6 Sep 2018 16:30:56 +0100
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2 2/3] bridge: use print_json for some outputs
Rather than using is_json_context(), use the print_string functions
which handle both cases.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
bridge/mdb.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/bridge/mdb.c b/bridge/mdb.c
index 9bdef0262c54..cc1b4547865c 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -131,15 +131,8 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
if (n->nlmsg_type == RTM_DELMDB)
print_bool(PRINT_ANY, "deleted", "Deleted ", true);
-
- if (is_json_context()) {
- print_int(PRINT_JSON, "index", NULL, ifindex);
- print_string(PRINT_JSON, "dev", NULL, dev);
- } else {
- fprintf(f, "%u: ", ifindex);
- color_fprintf(f, COLOR_IFNAME, "%s ", dev);
- }
-
+ print_int(PRINT_ANY, "index", "%u: ", ifindex);
+ print_color_string(PRINT_ANY, COLOR_IFNAME, "dev", "%s ", dev);
print_string(PRINT_ANY, "port", " %s ",
ll_index_to_name(e->ifindex));
--
2.17.1
Powered by blists - more mailing lists