From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: dsahern@kernel.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2-next 03/10] lib: rename parameters that shadow globals
Date: Mon, 30 Nov 2026 10:47:04 -0800 [thread overview]
Message-ID: <20261130184752.545119-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20261130184752.545119-1-stephen@networkplumber.org>
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 <stephen@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
next prev parent reply other threads:[~2026-11-30 19:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 18:47 [PATCH iproute2-next 00/10] fix shadowed variable warnings Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 01/10] xfrm: rename shadowed SA direction local Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 02/10] ip address: rename the shadowed parameter of ipaddr_reset_filter() Stephen Hemminger
2026-11-30 18:47 ` Stephen Hemminger [this message]
2026-11-30 18:47 ` [PATCH iproute2-next 04/10] xfrm: rename local netlink handles that shadow the global rth Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 05/10] tc: rename and drop shadowing locals Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 06/10] ip: " Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 07/10] ifstat: rename shadowing local Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 08/10] bridge, devlink, rdma: rename shadowing locals Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 09/10] ss: fix shadowed variable warnings Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 10/10] Makefile: enable " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130184752.545119-4-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox