Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1201497 > unrolled thread

[tip:perf/core] perf tools: Do not include escape sequences in color_vfprintf return

Started bytip-bot for Andi Kleen <tipbot@zytor.com>
First post2015-08-06 09:10 +0200
Last post2015-08-06 09:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [tip:perf/core] perf tools:   Do not include escape sequences in color_vfprintf return tip-bot for Andi Kleen <tipbot@zytor.com> - 2015-08-06 09:10 +0200

#1201497 — [tip:perf/core] perf tools: Do not include escape sequences in color_vfprintf return

Fromtip-bot for Andi Kleen <tipbot@zytor.com>
Date2015-08-06 09:10 +0200
Subject[tip:perf/core] perf tools: Do not include escape sequences in color_vfprintf return
Message-ID<pUntr-1Db-77@gated-at.bofh.it>
Commit-ID:  b7a001d2067830a98e65d1bbbf99a6d435d70616
Gitweb:     http://git.kernel.org/tip/b7a001d2067830a98e65d1bbbf99a6d435d70616
Author:     Andi Kleen <ak@linux.intel.com>
AuthorDate: Mon, 3 Aug 2015 17:50:02 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 5 Aug 2015 16:46:06 -0300

perf tools: Do not include escape sequences in color_vfprintf return

color_vprintf was including the length of the invisible escape sequences
in its return argument. Don't include them to make the return value
usable for indentation calculations.

v2: Add comment, rebase

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1438649408-20807-3-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/color.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index ff051d2..9b95654 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -67,6 +67,7 @@ static int __color_vsnprintf(char *bf, size_t size, const char *color,
 	return r;
 }
 
+/* Colors are not included in return value */
 static int __color_vfprintf(FILE *fp, const char *color, const char *fmt,
 		va_list args)
 {
@@ -83,10 +84,10 @@ static int __color_vfprintf(FILE *fp, const char *color, const char *fmt,
 	}
 
 	if (perf_use_color_default && *color)
-		r += fprintf(fp, "%s", color);
+		fprintf(fp, "%s", color);
 	r += vfprintf(fp, fmt, args);
 	if (perf_use_color_default && *color)
-		r += fprintf(fp, "%s", PERF_COLOR_RESET);
+		fprintf(fp, "%s", PERF_COLOR_RESET);
 	return r;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web