perf tools: Remove unused color_fwrite_lines
PATCH 1/1 perf tools: Remove unused color_fwrite_lines
From: "Dr. David Alan Gilbert" <[email protected]>
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 <[email protected]>
--- tools/perf/util/color.c | 28 ---------------------------- tools/perf/util/color.h | 1 - 2 files changed, 29 deletions(-)
tools/perf/util/color.c +0 -28
@@ -93,34 +93,6 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...)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 *color =PERF_COLOR_NORMAL ;
tools/perf/util/color.h +0 -1
@@ -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_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_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 percent_color_snprintf (char *bf,size_t size,const char *fmt, ...);int percent_color_len_snprintf (char *bf,size_t size,const char *fmt, ...);
Signature · 1 line
2.46.2
Quoted 11 lines · On Tue, Oct 8, 2024 at 5:39 PM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
color_fwrite_lines()was added by 2009's commit8fc0321f1ad0("perf_countertools: Add color terminal output support")but has never been used.
Remove it.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
Reviewed-by Ian Rogers <[email protected]>
Thanks,
Ian
Quoted 59 lines
--- tools/perf/util/color.c | 28 ---------------------------- tools/perf/util/color.h | 1 - 2 files changed, 29 deletions(-)tools/perf/util/color.c +0
-28@@ -93,34 +93,6 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...)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 *color =PERF_COLOR_NORMAL ;tools/perf/util/color.h +0
-2@@ -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_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_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 percent_color_snprintf (char *bf,size_t size,const char *fmt, ...);int percent_color_len_snprintf (char *bf,size_t size,const char *fmt, ...); --2.46.2
Quoted 8 lines · On Wed, 09 Oct 2024 01:39:38 +0100, [email protected] wrote:
color_fwrite_lines()was added by 2009's commit8fc0321f1ad0("perf_countertools: Add color terminal output support")but has never been used.
Remove it.
[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung