new_json_obj(), new_json_obj_plain(), __new_json_obj() and check_enable_color() take an int parameter named json, which shadows the global of the same name. print_color_rate() does the same with use_iec. Rename the parameters; no functional change. Signed-off-by: Stephen Hemminger <step…@networkplumber.org> --- include/color.h | 2 +- include/json_print.h | 10 +++++----- lib/color.c | 4 ++-- lib/json_print.c | 18 +++++++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/color.h b/include/color.h index b543c267..4d9fff1f 100644 --- a/include/color.h +++ b/include/color.h @@ -21,7 +21,7 @@ enum color_opt { }; int default_color_opt(void); -bool check_enable_color(int color, int json); +bool check_enable_color(int color, int is_json); bool matches_color(const char *arg, int *val); int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...); enum color_attr ifa_family_color(__u8 ifa_family); diff --git a/include/json_print.h b/include/json_print.h index 79d8d4ff..56e82743 100644 --- a/include/json_print.h +++ b/include/json_print.h @@ -32,9 +32,9 @@ enum output_type { PRINT_ANY = 4, }; -void new_json_obj(int json); +void new_json_obj(int is_json); void delete_json_obj(void); -void new_json_obj_plain(int json); +void new_json_obj_plain(int is_json); void delete_json_obj_plain(void); bool is_json_context(void); @@ -94,14 +94,14 @@ _PRINT_NAME_VALUE_FUNC(uint, unsigned int, u); _PRINT_NAME_VALUE_FUNC(string, const char*, s); #undef _PRINT_NAME_VALUE_FUNC -int print_color_rate(bool use_iec, enum output_type t, enum color_attr color, +int print_color_rate(bool 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, +static inline int print_rate(bool 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); + return print_color_rate(iec, t, COLOR_NONE, key, fmt, rate); } unsigned int print_range(const char *name, __u32 start, __u32 end); diff --git a/lib/color.c b/lib/color.c index aa112352..ddfda58a 100644 --- a/lib/color.c +++ b/lib/color.c @@ -97,9 +97,9 @@ int default_color_opt(void) return CONF_COLOR; } -bool check_enable_color(int color, int json) +bool check_enable_color(int color, int is_json) { - if (json || color == COLOR_OPT_NEVER) + if (is_json || color == COLOR_OPT_NEVER) return false; if (color == COLOR_OPT_ALWAYS || isatty(fileno(stdout))) { diff --git a/lib/json_print.c b/lib/json_print.c index e028e766..864e250b 100644 --- a/lib/json_print.c +++ b/lib/json_print.c @@ -13,9 +13,9 @@ static json_writer_t *_jw; -static void __new_json_obj(int json, bool have_array) +static void __new_json_obj(int is_json, bool have_array) { - if (json) { + if (is_json) { _jw = jsonw_new(stdout); if (!_jw) { perror("json object"); @@ -37,9 +37,9 @@ static void __delete_json_obj(bool have_array) } } -void new_json_obj(int json) +void new_json_obj(int is_json) { - __new_json_obj(json, true); + __new_json_obj(is_json, true); } void delete_json_obj(void) @@ -47,9 +47,9 @@ void delete_json_obj(void) __delete_json_obj(true); } -void new_json_obj_plain(int json) +void new_json_obj_plain(int is_json) { - __new_json_obj(json, false); + __new_json_obj(is_json, false); } void delete_json_obj_plain(void) @@ -352,11 +352,11 @@ void print_nl(void) printf("%s", _SL_); } -int print_color_rate(bool use_iec, enum output_type type, enum color_attr color, +int print_color_rate(bool iec, enum output_type type, enum color_attr color, const char *key, const char *fmt, unsigned long long rate) { - unsigned long kilo = use_iec ? 1024 : 1000; - const char *str = use_iec ? "i" : ""; + unsigned long kilo = iec ? 1024 : 1000; + const char *str = iec ? "i" : ""; static char *units[5] = {"", "K", "M", "G", "T"}; char *buf; int rc;
-- 2.53.0