From: Davide Caratti <dcaratti@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
David Ahern <dsahern@gmail.com>
Cc: Andrea Claudi <aclaudi@redhat.com>, netdev@vger.kernel.org
Subject: [PATCH iproute2-next] use print_{,h}hu instead of print_uint when format specifier is %{,h}hu
Date: Thu, 7 Feb 2019 11:51:27 +0100 [thread overview]
Message-ID: <318e07e5b1d43e31f9664ff0b3628d4f2994aea9.1549536471.git.dcaratti@redhat.com> (raw)
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>
---
ip/ipl2tp.c | 4 ++--
lib/bpf.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index f699b258a3f0..77bc3249c7ec 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -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();
diff --git a/lib/bpf.c b/lib/bpf.c
index dfc4f4f522c3..c7b3ee1e9618 100644
--- 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
--
2.20.1
next reply other threads:[~2019-02-07 10:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 10:51 Davide Caratti [this message]
2019-02-11 3:01 ` [PATCH iproute2-next] use print_{,h}hu instead of print_uint when format specifier is %{,h}hu David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=318e07e5b1d43e31f9664ff0b3628d4f2994aea9.1549536471.git.dcaratti@redhat.com \
--to=dcaratti@redhat.com \
--cc=aclaudi@redhat.com \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).