]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
bridge: use print_json for some outputs
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 6 Sep 2018 13:15:36 +0000 (14:15 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 10 Sep 2018 18:47:11 +0000 (11:47 -0700)
Rather than using is_json_context(), use the print_string functions
which handle both cases.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
bridge/mdb.c

index 9bdef0262c546c7938e54ba0800b80f95d1fbef8..cc1b4547865c1d63c6bbaff6ae1acf2e8b05e09f 100644 (file)
@@ -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));