use print_{,h}hu instead of print_uint when format specifier is %{,h}hu

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>
This commit is contained in:
Davide Caratti 2019-02-07 11:51:27 +01:00 committed by David Ahern
parent 05bc89e95e
commit ca81444303
2 changed files with 5 additions and 5 deletions

View 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();

View File

@ -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