Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1199347
| From | Andi Kleen <andi@firstfloor.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/8] perf, tools: Do not include escape sequences in color_vfprintf return |
| Date | 2015-08-04 03:00 +0200 |
| Message-ID | <pTyKe-322-17@gated-at.bofh.it> (permalink) |
| References | <pTyKe-322-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Andi Kleen <ak@linux.intel.com>
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>
---
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;
}
--
2.4.3
--
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/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 2/8] perf, tools: Do not include escape sequences in color_vfprintf return Andi Kleen <andi@firstfloor.org> - 2015-08-04 03:00 +0200
csiph-web