aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2015-08-03 20:50:02 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-08-05 15:46:06 -0400
commitb7a001d2067830a98e65d1bbbf99a6d435d70616 (patch)
tree14d939073a15e0a564b0ce7bd92d0fdda28e05e2 /tools
parent8011de7ab3b10c5352f3f0708f517de2722b0957 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/color.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index ff051d24a0bb..9b9565416f90 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,
67 return r; 67 return r;
68} 68}
69 69
70/* Colors are not included in return value */
70static int __color_vfprintf(FILE *fp, const char *color, const char *fmt, 71static int __color_vfprintf(FILE *fp, const char *color, const char *fmt,
71 va_list args) 72 va_list args)
72{ 73{
@@ -83,10 +84,10 @@ static int __color_vfprintf(FILE *fp, const char *color, const char *fmt,
83 } 84 }
84 85
85 if (perf_use_color_default && *color) 86 if (perf_use_color_default && *color)
86 r += fprintf(fp, "%s", color); 87 fprintf(fp, "%s", color);
87 r += vfprintf(fp, fmt, args); 88 r += vfprintf(fp, fmt, args);
88 if (perf_use_color_default && *color) 89 if (perf_use_color_default && *color)
89 r += fprintf(fp, "%s", PERF_COLOR_RESET); 90 fprintf(fp, "%s", PERF_COLOR_RESET);
90 return r; 91 return r;
91} 92}
92 93