Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Remove unused color_fwrite_lines

color_fwrite_lines() was added by 2009's commit
8fc0321f1ad0 ("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>

authored by

Dr. David Alan Gilbert and committed by
Namhyung Kim
c7c1bb78 9f759d41

-29
-28
tools/perf/util/color.c
··· 93 93 return r; 94 94 } 95 95 96 - /* 97 - * This function splits the buffer by newlines and colors the lines individually. 98 - * 99 - * Returns 0 on success. 100 - */ 101 - int color_fwrite_lines(FILE *fp, const char *color, 102 - size_t count, const char *buf) 103 - { 104 - if (!*color) 105 - return fwrite(buf, count, 1, fp) != 1; 106 - 107 - while (count) { 108 - char *p = memchr(buf, '\n', count); 109 - 110 - if (p != buf && (fputs(color, fp) < 0 || 111 - fwrite(buf, p ? (size_t)(p - buf) : count, 1, fp) != 1 || 112 - fputs(PERF_COLOR_RESET, fp) < 0)) 113 - return -1; 114 - if (!p) 115 - return 0; 116 - if (fputc('\n', fp) < 0) 117 - return -1; 118 - count -= p + 1 - buf; 119 - buf = p + 1; 120 - } 121 - return 0; 122 - } 123 - 124 96 const char *get_percent_color(double percent) 125 97 { 126 98 const char *color = PERF_COLOR_NORMAL;
-1
tools/perf/util/color.h
··· 39 39 int color_vfprintf(FILE *fp, const char *color, const char *fmt, va_list args); 40 40 int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); 41 41 int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...); 42 - int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf); 43 42 int value_color_snprintf(char *bf, size_t size, const char *fmt, double value); 44 43 int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...); 45 44 int percent_color_len_snprintf(char *bf, size_t size, const char *fmt, ...);