Skip to contentSkip to conversation

tracing/function-graph-tracer: strip ending newlines on comments

PATCH Applied Frederic Weisbecker 2 participants 2 messages Dec 24, 2008 – Dec 26, 2008 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 tracing/function-graph-tracer: strip ending newlines on comments

Impact: trivial output improvement

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

---
 kernel/trace/trace_functions_graph.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
kernel/trace/trace_functions_graph.c +6 -0
index 4bf39fc..bc7d908 100644
@@ -592,6 +592,12 @@ print_graph_comment(struct print_entry *trace, struct trace_seq *s,
 	if (ent->flags & TRACE_FLAG_CONT)
 		trace_seq_print_cont(s, iter);
 
+	/* Strip ending newline */
+	if (s->buffer[s->len - 1] == '\n') {
+		s->buffer[s->len - 1] = '\0';
+		s->len--;
+	}
+
 	ret = trace_seq_printf(s, " */\n");
 	if (!ret)
 		return TRACE_TYPE_PARTIAL_LINE;
Signature · 1 line
1.6.0.4
Applied
#1 lore raw
Quoted 10 lines · Frederic Weisbecker

Impact: trivial output improvement

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

---
 kernel/trace/trace_functions_graph.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

applied to tip/tracing/function-graph-tracer, thanks Frederic!

Ingo