[PATCH 6/9] perf, tools: Fix srcline sort key output to use width

From: Andi Kleen
Date: Fri Jun 20 2014 - 19:43:16 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

The srcline sort output ignored the width, which caused
various problems with displaying srcline in the tui
browser. Just cut it off at width.

Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
tools/perf/util/sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 45512ba..901f44b 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -304,7 +304,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
size_t size,
unsigned int width __maybe_unused)
{
- return repsep_snprintf(bf, size, "%s", he->srcline);
+ return repsep_snprintf(bf, size, "%.*s", width, he->srcline);
}

struct sort_entry sort_srcline = {
--
1.9.3

--
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/