On Mon, 20 Aug 2018 14:42:15 -0700
Mahesh Bandewar <mah...@bandewar.net> 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.

Reply via email to