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

* [tip:perf/core] perf: Use format string of printf to align strings
  2009-12-14  8:23 [Patch] perf: use format string of printf to align strings Amerigo Wang
@ 2009-12-28 10:04 ` tip-bot for Amerigo Wang
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Amerigo Wang @ 2009-12-28 10:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	amwang, fweisbec, tglx, mingo

Commit-ID:  3912f2abc942a002ef611fc973add5e5eadb3432
Gitweb:     http://git.kernel.org/tip/3912f2abc942a002ef611fc973add5e5eadb3432
Author:     Amerigo Wang <amwang@redhat.com>
AuthorDate: Mon, 14 Dec 2009 03:23:56 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 28 Dec 2009 09:03:16 +0100

perf: Use format string of printf to align strings

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

This simplifies the code a bit.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091214082700.4224.57640.sendpatchset@localhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/builtin-help.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

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