Skip to contentSkip to conversation

net/tipc: use %*phC to dump small buffers in hex form

PATCH Applied Andy Shevchenko 2 participants 2 messages Jul 10, 2013 – Jul 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/tipc: use %*phC to dump small buffers in hex form

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

---
 net/tipc/ib_media.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
net/tipc/ib_media.c +1 -7
index ad2e1ec..9934a32 100644
@@ -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;
 }
Signature · 1 line
1.8.3.2
maintainer Applied
#1 lore raw

From: Andy Shevchenko <[email protected]>
Date: Wed, 10 Jul 2013 17:30:34 +0300

Quoted 3 lines

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

Applied, thanks.

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk