[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190210123443.206a2a7e@hermes.lan>
Date: Sun, 10 Feb 2019 12:34:43 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Aya Levin <ayal@...lanox.com>
Cc: David Ahern <dsahern@...il.com>, netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Jiri Pirko <jiri@...lanox.com>,
Moshe Shemesh <moshe@...lanox.com>,
Eran Ben Elisha <eranbe@...lanox.com>,
Tal Alon <talal@...lanox.com>,
Ariel Almog <ariela@...lanox.com>
Subject: Re: [PATCH for-next 3/4] devlink: fix boolean JSON print
On Sun, 10 Feb 2019 20:28:48 +0200
Aya Levin <ayal@...lanox.com> wrote:
> This patch removes the inverted commas from boolean values in JSON
> format: true/false instead of "true"/"false".
>
> Signed-off-by: Aya Levin <ayal@...lanox.com>
> Reviewed-by: Moshe Shemesh <moshe@...lanox.com>
> ---
> devlink/devlink.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 46e2e41c5dfd..a433883f1b2b 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -1605,10 +1605,10 @@ static void pr_out_str(struct dl *dl, const char *name, const char *val)
>
> static void pr_out_bool(struct dl *dl, const char *name, bool val)
> {
> - if (val)
> - pr_out_str(dl, name, "true");
> + if (dl->json_output)
> + jsonw_bool_field(dl->jw, name, val);
> else
> - pr_out_str(dl, name, "false");
> + pr_out_str(dl, name, val ? "true" : "false");
> }
>
> static void pr_out_uint(struct dl *dl, const char *name, unsigned int val)
There is already print_bool in json_print why is that not used?
Powered by blists - more mailing lists