From: Stephen Hemminger Date: Tue, 1 Feb 2022 04:28:18 +0000 (-0800) Subject: tc_util: fix breakage from clang changes X-Git-Tag: v5.18.0~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9948b6cb92c50ecc3d39d0b4d4c814d299f01cec;p=thirdparty%2Fiproute2.git tc_util: fix breakage from clang changes This fixes the indentation of types with newline flag. Signed-off-by: Stephen Hemminger Signed-off-by: David Ahern --- diff --git a/tc/tc_util.c b/tc/tc_util.c index 67960d2c0..78cb9901f 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); } }