[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220201042819.322106-1-stephen@networkplumber.org>
Date: Mon, 31 Jan 2022 20:28:18 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: dsahern@...il.com
Cc: netdev@...r.kernel.org, Victor Nogueira <victor@...atatu.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2-next 1/2] tc_util: fix breakage from clang changes
This fixes the indentation of types with newline flag.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
The clang changes merged an earlier version of the changes
to print_masked_type.
tc/tc_util.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/tc/tc_util.c b/tc/tc_util.c
index 67960d2c03d7..78cb9901f7b9 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -784,8 +784,6 @@ static void print_masked_type(__u32 type_max,
struct rtattr *mask_attr, bool newline)
{
__u32 value, mask;
- SPRINT_BUF(out);
- size_t done;
if (!attr)
return;
@@ -793,21 +791,18 @@ static void print_masked_type(__u32 type_max,
value = rta_getattr_type(attr);
mask = mask_attr ? rta_getattr_type(mask_attr) : type_max;
- if (is_json_context()) {
- print_hu(PRINT_JSON, name, NULL, value);
- if (mask != type_max) {
- char mask_name[SPRINT_BSIZE-6];
+ if (newline)
+ print_string(PRINT_FP, NULL, "%s ", _SL_);
+ else
+ print_string(PRINT_FP, NULL, " ", _SL_);
- sprintf(mask_name, "%s_mask", name);
- print_hu(PRINT_JSON, mask_name, NULL, mask);
- }
- } else {
- done = sprintf(out, "%u", value);
- if (mask != type_max)
- sprintf(out + done, "/0x%x", mask);
+ print_uint_name_value(name, value);
+
+ if (mask != type_max) {
+ char mask_name[SPRINT_BSIZE-6];
- print_nl();
- print_string_name_value(name, out);
+ snprintf(mask_name, sizeof(mask_name), "%s_mask", name);
+ print_hex(PRINT_ANY, mask_name, "/0x%x", mask);
}
}
--
2.34.1
Powered by blists - more mailing lists