From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?TWFoZXNoIEJhbmRld2FyICjgpK7gpLngpYfgpLYg4KSs4KSC4KSh4KWH4KS14KS+4KSwKQ==?= Subject: Re: [PATCH iproute2] iproute: make clang happy Date: Mon, 20 Aug 2018 17:32:36 -0700 Message-ID: References: <20180820214215.218127-1-mahesh@bandewar.net> <20180820155038.30d0f08c@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Mahesh Bandewar , netdev To: Stephen Hemminger Return-path: Received: from mail-wm0-f43.google.com ([74.125.82.43]:54629 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726639AbeHUDus (ORCPT ); Mon, 20 Aug 2018 23:50:48 -0400 Received: by mail-wm0-f43.google.com with SMTP id c14-v6so1223801wmb.4 for ; Mon, 20 Aug 2018 17:32:58 -0700 (PDT) In-Reply-To: <20180820155038.30d0f08c@xeon-e3> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Aug 20, 2018 at 3:50 PM, Stephen Hemminger wrote: > On Mon, 20 Aug 2018 14:42:15 -0700 > Mahesh Bandewar wrote: > >> >> if (is_json_context()) { >> + json_writer_t *jw; >> + >> open_json_object("bittiming"); >> print_int(PRINT_ANY, "bitrate", NULL, bt->bitrate); >> - jsonw_float_field_fmt(get_json_writer(), >> - "sample_point", "%.3f", >> - (float) bt->sample_point / 1000.); >> + jw = get_json_writer(); >> + jsonw_name(jw, "sample_point"); >> + jsonw_printf(jw, "%.3f", >> + (float) bt->sample_point / 1000); > > I think it would be better to get rid of the is_json_context() here in the CAN code > and just use the print_json functions completely. Most of the other code is able to > do that already. Seems like this is not the only location and need to be taken care every where in the CAN code. I'll leave it to some JSON / print expert