[tip:perf/core] perf: Use format string of printf to align strings

From: tip-bot for Amerigo Wang
Date: Mon Dec 28 2009 - 05:06:21 EST


Commit-ID: 3912f2abc942a002ef611fc973add5e5eadb3432
Gitweb: http://git.kernel.org/tip/3912f2abc942a002ef611fc973add5e5eadb3432
Author: Amerigo Wang <amwang@xxxxxxxxxx>
AuthorDate: Mon, 14 Dec 2009 03:23:56 -0500
Committer: Ingo Molnar <mingo@xxxxxxx>
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@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
LKML-Reference: <20091214082700.4224.57640.sendpatchset@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
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);
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/