[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211140732.11475-20-bpoirier@nvidia.com>
Date: Mon, 11 Dec 2023 09:07:31 -0500
From: Benjamin Poirier <bpoirier@...dia.com>
To: netdev@...r.kernel.org
Cc: Petr Machata <petrm@...dia.com>,
Roopa Prabhu <roopa@...dia.com>
Subject: [PATCH iproute2-next 19/20] json_print: Rename print_range() argument
The second argument's purpose is better conveyed by calling it "end" rather
than "id" so rename it.
Reviewed-by: Petr Machata <petrm@...dia.com>
Tested-by: Petr Machata <petrm@...dia.com>
Signed-off-by: Benjamin Poirier <bpoirier@...dia.com>
---
include/json_print.h | 2 +-
lib/json_print.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/json_print.h b/include/json_print.h
index 86dc5f16..daebcf5d 100644
--- a/include/json_print.h
+++ b/include/json_print.h
@@ -97,7 +97,7 @@ static inline int print_rate(bool use_iec, enum output_type t,
return print_color_rate(use_iec, t, COLOR_NONE, key, fmt, rate);
}
-unsigned int print_range(const char *name, __u32 start, __u32 id);
+unsigned int print_range(const char *name, __u32 start, __u32 end);
int print_color_bool_opt(enum output_type type, enum color_attr color,
const char *key, bool value, bool show);
diff --git a/lib/json_print.c b/lib/json_print.c
index f38171ff..7b3b6c3f 100644
--- a/lib/json_print.c
+++ b/lib/json_print.c
@@ -375,16 +375,16 @@ int print_color_rate(bool use_iec, enum output_type type, enum color_attr color,
return rc;
}
-unsigned int print_range(const char *name, __u32 start, __u32 id)
+unsigned int print_range(const char *name, __u32 start, __u32 end)
{
int width;
width = print_uint(PRINT_ANY, name, "%u", start);
- if (start != id) {
- char end[64];
+ if (start != end) {
+ char buf[64];
- snprintf(end, sizeof(end), "%sEnd", name);
- width += print_uint(PRINT_ANY, end, "-%u", id);
+ snprintf(buf, sizeof(buf), "%sEnd", name);
+ width += print_uint(PRINT_ANY, buf, "-%u", end);
}
return width;
--
2.43.0
Powered by blists - more mailing lists