Netdev Archive on lore.kernel.org
 help / 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	[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, back to index

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

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox