diff mbox series

[iproute2-next,1/2] tc_util: fix breakage from clang changes

Message ID 20220201042819.322106-1-stephen@networkplumber.org (mailing list archive)
State Accepted
Commit 9948b6cb92c50ecc3d39d0b4d4c814d299f01cec
Delegated to: David Ahern
Headers show
Series [iproute2-next,1/2] tc_util: fix breakage from clang changes | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Stephen Hemminger Feb. 1, 2022, 4:28 a.m. UTC
This fixes the indentation of types with newline flag.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.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(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 1, 2022, 4:10 p.m. UTC | #1
Hello:

This series was applied to iproute2/iproute2-next.git (main)
by David Ahern <dsahern@kernel.org>:

On Mon, 31 Jan 2022 20:28:18 -0800 you wrote:
> This fixes the indentation of types with newline flag.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> The clang changes merged an earlier version of the changes
> to print_masked_type.
> 
> [...]

Here is the summary with links:
  - [iproute2-next,1/2] tc_util: fix breakage from clang changes
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=9948b6cb92c5
  - [iproute2-next,2/2] tc/f_flower: fix indentation
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=5f44590ddec5

You are awesome, thank you!
diff mbox series

Patch

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);
 	}
 }