Subject: Re: [PATCH iproute2-next 2/6] lib: Move print_rate() from tc here; modernize

From: Petr Machata <[email-masked]>
Date: Tue, 01 Dec 2020 23:56:11 +0100

Stephen Hemminger <[email-masked]> writes:

>> +int print_color_rate(bool use_iec, enum output_type t, enum color_attr color,
>> +		     const char *key, const char *fmt, unsigned long long rate);
>> +
>> +static inline int print_rate(bool use_iec, enum output_type t,
>> +			     const char *key, const char *fmt,
>> +			     unsigned long long rate)
>> +{
>> +	return print_color_rate(use_iec, t, COLOR_NONE, key, fmt, rate);
>> +}
>> +
>
> Overall this looks good, but is there any case where color output
> makes sense for this field? If not then why do all the color wrappers.

All the print_X functions in json_print comes with a print_color_X
flavor as well, even the ones where all clients just use the plain
output. (Notably the recently added on_off. Colors were even one of the
arguments in favor of putting that one to json_print, despite nobody
actually using them for on/off.)