On 7/8/20 11:33 PM, Stephen Hemminger wrote:
> On Thu, 09 Jul 2020 00:38:27 +0800
> "YU, Xiangning" <xiangning...@alibaba-inc.com> wrote:
> 
>> +static int ltb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
>> +                           struct nlmsghdr *n, const char *dev)
>> +{
>> +    struct tc_ltb_opt opt;
> 
> If you use empty initializer in C it will make everything 0 and save you some 
> pain.
> 
>       struct tc_ltb_opt opt = { };
> 

Thank you!
> 
>> +            fprintf(f, "rate %s ", sprint_rate(rate64, b1));
>> +            fprintf(f, "ceil %s ", sprint_rate(ceil64, b1));
>> +            if (show_details) {
>> +                    fprintf(f, "measured %llu allocated %llu highwater 
>> %llu",
>> +                            lopt->measured, lopt->allocated,
>> +                            lopt->high_water);
> 
> 
> All output has to be in JSON. Any use of fprintf(f, ...) directly
> is a indication to me of code that is not supporting JSON correctly.
> 

I see your point now. Looks like everything is heading to support JSON, but we 
have some thing left in other files to be cleaned up. Will change all fprintf 
in this file.

Thanks,
- Xiangning

Reply via email to