netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/tipc: use %*phC to dump small buffers in hex form
@ 2013-07-10 14:30 Andy Shevchenko
  2013-07-12  0:03 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2013-07-10 14:30 UTC (permalink / raw)
  To: Jon Maloy, David S. Miller, netdev, tipc-discussion; +Cc: Andy Shevchenko

Instead of passing each byte by stack let's use nice specifier for that.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 net/tipc/ib_media.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/net/tipc/ib_media.c b/net/tipc/ib_media.c
index ad2e1ec..9934a32 100644
--- a/net/tipc/ib_media.c
+++ b/net/tipc/ib_media.c
@@ -292,13 +292,7 @@ static int ib_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size)
 	if (str_size < 60)	/* 60 = 19 * strlen("xx:") + strlen("xx\0") */
 		return 1;
 
-	sprintf(str_buf, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:"
-			 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
-		a->value[0], a->value[1], a->value[2], a->value[3],
-		a->value[4], a->value[5], a->value[6], a->value[7],
-		a->value[8], a->value[9], a->value[10], a->value[11],
-		a->value[12], a->value[13], a->value[14], a->value[15],
-		a->value[16], a->value[17], a->value[18], a->value[19]);
+	sprintf(str_buf, "%20phC", a->value);
 
 	return 0;
 }
-- 
1.8.3.2

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

end of thread, other threads:[~2013-07-12  0:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-10 14:30 [PATCH] net/tipc: use %*phC to dump small buffers in hex form Andy Shevchenko
2013-07-12  0:03 ` David Miller

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