]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
use print_{,h}hu instead of print_uint when format specifier is %{,h}hu
authorDavide Caratti <dcaratti@redhat.com>
Thu, 7 Feb 2019 10:51:27 +0000 (11:51 +0100)
committerDavid Ahern <dsahern@gmail.com>
Mon, 11 Feb 2019 03:00:59 +0000 (19:00 -0800)
in this way, a useless cast to unsigned int is avoided in bpf_print_ops()
and print_tunnel().

Tested with:
 # ./tdc.py -c bpf

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Cc: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
ip/ipl2tp.c
lib/bpf.c

index f699b258a3f09b076c69254dc52fb042bb636200..77bc3249c7ec7244c41bc08ec46028ff159387fe 100644 (file)
@@ -237,9 +237,9 @@ static void print_tunnel(const struct l2tp_data *data)
                print_string(PRINT_FP, NULL,
                             "  UDP source / dest ports:", NULL);
 
-               print_uint(PRINT_ANY, "local_port", " %hu",
+               print_hu(PRINT_ANY, "local_port", " %hu",
                           p->local_udp_port);
-               print_uint(PRINT_ANY, "peer_port", "/%hu",
+               print_hu(PRINT_ANY, "peer_port", "/%hu",
                           p->peer_udp_port);
                print_nl();
 
index dfc4f4f522c311a67b89f26515f19cd1fac85f41..c7b3ee1e9618200d706f9ef5876df0359de84d59 100644 (file)
--- a/lib/bpf.c
+++ b/lib/bpf.c
@@ -353,9 +353,9 @@ void bpf_print_ops(struct rtattr *bpf_ops, __u16 len)
 
        for (i = 0; i < len; i++) {
                open_json_object(NULL);
-               print_uint(PRINT_ANY, "code", "%hu ", ops[i].code);
-               print_uint(PRINT_ANY, "jt", "%hhu ", ops[i].jt);
-               print_uint(PRINT_ANY, "jf", "%hhu ", ops[i].jf);
+               print_hu(PRINT_ANY, "code", "%hu ", ops[i].code);
+               print_hhu(PRINT_ANY, "jt", "%hhu ", ops[i].jt);
+               print_hhu(PRINT_ANY, "jf", "%hhu ", ops[i].jf);
                if (i == len - 1)
                        print_uint(PRINT_ANY, "k", "%u\'", ops[i].k);
                else