]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
devlink: Remove enclosing array brackets binary print with json format
authorAya Levin <ayal@mellanox.com>
Wed, 10 Jul 2019 11:03:21 +0000 (14:03 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 15 Jul 2019 20:50:55 +0000 (13:50 -0700)
Keep pr_out_binary_value function only for printing. Inner relations
like array grouping should be done outside the function.

Fixes: 844a61764c6f ("devlink: Add helper functions for name and value separately")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
devlink/devlink.c

index 6b28138d589553530d2a0eed5a15ce31dfc628e6..bb023c0c266d318e07bb3ae51ea51f8ffccc93e7 100644 (file)
@@ -1788,9 +1788,6 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)
 {
        int i = 0;
 
-       if (dl->json_output)
-               jsonw_start_array(dl->jw);
-
        while (i < len) {
                if (dl->json_output)
                        jsonw_printf(dl->jw, "%d", data[i]);
@@ -1800,9 +1797,7 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)
                if (!dl->json_output && is_binary_eol(i))
                        __pr_out_newline();
        }
-       if (dl->json_output)
-               jsonw_end_array(dl->jw);
-       else if (!is_binary_eol(i))
+       if (!dl->json_output && !is_binary_eol(i))
                __pr_out_newline();
 }