netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next] use print_{,h}hu instead of print_uint when format specifier is %{,h}hu
@ 2019-02-07 10:51 Davide Caratti
  2019-02-11  3:01 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Davide Caratti @ 2019-02-07 10:51 UTC (permalink / raw)
  To: Stephen Hemminger, David Ahern; +Cc: Andrea Claudi, netdev

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2-next] use print_{,h}hu instead of print_uint when format specifier is %{,h}hu
  2019-02-07 10:51 [PATCH iproute2-next] use print_{,h}hu instead of print_uint when format specifier is %{,h}hu Davide Caratti
@ 2019-02-11  3:01 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2019-02-11  3:01 UTC (permalink / raw)
  To: Davide Caratti, Stephen Hemminger; +Cc: Andrea Claudi, netdev

On 2/7/19 3:51 AM, Davide Caratti wrote:
> 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(-)
> 

applied to iproute2-next. Thanks



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-11  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 10:51 [PATCH iproute2-next] use print_{,h}hu instead of print_uint when format specifier is %{,h}hu Davide Caratti
2019-02-11  3:01 ` David Ahern

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).