public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing/function-graph-tracer: strip ending newlines on comments
@ 2008-12-22 18:16 Frederic Weisbecker
  2008-12-23  6:48 ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Frederic Weisbecker @ 2008-12-22 18:16 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Linux Kernel

Impact: trivial output improvement

Ending newlines are appended automatically on comments by the function graph tracer
because the newlines needs to be placed after the "*/" characters.
So if the user puts an ending whitespace, we want to strip it.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 4bf39fc..20c0b0d 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -540,6 +540,7 @@ print_graph_comment(struct print_entry *trace, struct trace_seq *s,
 		   struct trace_entry *ent, struct trace_iterator *iter)
 {
 	int i;
+	int len;
 	int ret;
 
 	/* Pid */
@@ -584,6 +585,11 @@ print_graph_comment(struct print_entry *trace, struct trace_seq *s,
 				return TRACE_TYPE_PARTIAL_LINE;
 		}
 
+	/* Strip ending newline on the comment */
+	len = strlen(trace->buf);
+	if (trace->buf[len - 1] == '\n')
+		trace->buf[len - 1] = '\0';
+
 	/* The comment */
 	ret = trace_seq_printf(s, "/* %s", trace->buf);
 	if (!ret)
-- 
1.6.0.4


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

end of thread, other threads:[~2008-12-23 12:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-22 18:16 [PATCH] tracing/function-graph-tracer: strip ending newlines on comments Frederic Weisbecker
2008-12-23  6:48 ` Ingo Molnar
2008-12-23  8:18   ` Ingo Molnar
2008-12-23 12:31     ` Frédéric Weisbecker
2008-12-23 12:14   ` Frédéric Weisbecker
2008-12-23 12:18     ` Ingo Molnar

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