mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [Patch] perf: use format string of printf to align strings
@ 2009-12-14  8:23 Amerigo Wang
  2009-12-28 10:04 ` [tip:perf/core] perf: Use " tip-bot for Amerigo Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Amerigo Wang @ 2009-12-14  8:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, Amerigo Wang

Instead of filling whitespaces to do alignment, use
printf's format string.

Signed-off-by: WANG Cong <amwang@redhat.com>

---
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 9f810b1..e427d69 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -286,8 +286,7 @@ void list_common_cmds_help(void)
 
 	puts(" The most commonly used perf commands are:");
 	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
-		printf("   %s   ", common_cmds[i].name);
-		mput_char(' ', longest - strlen(common_cmds[i].name));
+		printf("   %-*s   ", longest, common_cmds[i].name);
 		puts(common_cmds[i].help);
 	}
 }

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

end of thread, other threads:[~2009-12-28 10:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-14  8:23 [Patch] perf: use format string of printf to align strings Amerigo Wang
2009-12-28 10:04 ` [tip:perf/core] perf: Use " tip-bot for Amerigo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome