mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 18:55:12 +00:00
perf tools: Remove unused color_fwrite_lines
color_fwrite_lines() was added by 2009's commit
8fc0321f1a
("perf_counter tools: Add color terminal output support")
but has never been used.
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20241009003938.254936-1-linux@treblig.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
9f759d41b3
commit
c7c1bb78f3
@ -93,34 +93,6 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This function splits the buffer by newlines and colors the lines individually.
|
|
||||||
*
|
|
||||||
* Returns 0 on success.
|
|
||||||
*/
|
|
||||||
int color_fwrite_lines(FILE *fp, const char *color,
|
|
||||||
size_t count, const char *buf)
|
|
||||||
{
|
|
||||||
if (!*color)
|
|
||||||
return fwrite(buf, count, 1, fp) != 1;
|
|
||||||
|
|
||||||
while (count) {
|
|
||||||
char *p = memchr(buf, '\n', count);
|
|
||||||
|
|
||||||
if (p != buf && (fputs(color, fp) < 0 ||
|
|
||||||
fwrite(buf, p ? (size_t)(p - buf) : count, 1, fp) != 1 ||
|
|
||||||
fputs(PERF_COLOR_RESET, fp) < 0))
|
|
||||||
return -1;
|
|
||||||
if (!p)
|
|
||||||
return 0;
|
|
||||||
if (fputc('\n', fp) < 0)
|
|
||||||
return -1;
|
|
||||||
count -= p + 1 - buf;
|
|
||||||
buf = p + 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *get_percent_color(double percent)
|
const char *get_percent_color(double percent)
|
||||||
{
|
{
|
||||||
const char *color = PERF_COLOR_NORMAL;
|
const char *color = PERF_COLOR_NORMAL;
|
||||||
|
@ -39,7 +39,6 @@ int color_vsnprintf(char *bf, size_t size, const char *color,
|
|||||||
int color_vfprintf(FILE *fp, const char *color, const char *fmt, va_list args);
|
int color_vfprintf(FILE *fp, const char *color, const char *fmt, va_list args);
|
||||||
int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
|
int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
|
||||||
int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
|
int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
|
||||||
int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
|
|
||||||
int value_color_snprintf(char *bf, size_t size, const char *fmt, double value);
|
int value_color_snprintf(char *bf, size_t size, const char *fmt, double value);
|
||||||
int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
|
int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
|
||||||
int percent_color_len_snprintf(char *bf, size_t size, const char *fmt, ...);
|
int percent_color_len_snprintf(char *bf, size_t size, const char *fmt, ...);
|
||||||
|
Loading…
Reference in New Issue
Block a user