]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc_util: fix breakage from clang changes
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 1 Feb 2022 04:28:18 +0000 (20:28 -0800)
committerDavid Ahern <dsahern@kernel.org>
Tue, 1 Feb 2022 16:05:22 +0000 (09:05 -0700)
This fixes the indentation of types with newline flag.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
tc/tc_util.c

index 67960d2c03d781075fd61b7cfcac1d26c849844c..78cb9901f7b93d94c82c3edacc8d2625c7b2ebeb 100644 (file)
@@ -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);
        }
 }