From df7d960b0d7e1f9bd8aa58654760e41b6282f78a Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 5 May 2019 15:46:55 -0400 Subject: bftw: Pass a const struct BFTW * to the callback --- color.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'color.c') diff --git a/color.c b/color.c index 188e7ed..cf507fd 100644 --- a/color.c +++ b/color.c @@ -550,7 +550,7 @@ static bool is_link_broken(const struct BFTW *ftwbuf) { } /** Get the color for a file. */ -static const char *file_color(const struct colors *colors, const char *filename, struct BFTW *ftwbuf, enum bfs_stat_flag flags) { +static const char *file_color(const struct colors *colors, const char *filename, const struct BFTW *ftwbuf, enum bfs_stat_flag flags) { const struct bfs_stat *sb = bftw_stat(ftwbuf, flags); if (!sb) { if (colors->missing) { @@ -692,7 +692,7 @@ static int print_colored(const struct colors *colors, const char *esc, const cha } /** Print a path with colors. */ -static int print_path_colored(CFILE *cfile, const char *path, struct BFTW *ftwbuf, enum bfs_stat_flag flags) { +static int print_path_colored(CFILE *cfile, const char *path, const struct BFTW *ftwbuf, enum bfs_stat_flag flags) { const struct colors *colors = cfile->colors; FILE *file = cfile->file; @@ -715,7 +715,7 @@ static int print_path_colored(CFILE *cfile, const char *path, struct BFTW *ftwbu } /** Print the path to a file with the appropriate colors. */ -static int print_path(CFILE *cfile, struct BFTW *ftwbuf) { +static int print_path(CFILE *cfile, const struct BFTW *ftwbuf) { const struct colors *colors = cfile->colors; if (!colors) { return fputs(ftwbuf->path, cfile->file) == EOF ? -1 : 0; @@ -730,7 +730,7 @@ static int print_path(CFILE *cfile, struct BFTW *ftwbuf) { } /** Print a link target with the appropriate colors. */ -static int print_link_target(CFILE *cfile, struct BFTW *ftwbuf) { +static int print_link_target(CFILE *cfile, const struct BFTW *ftwbuf) { int ret = -1; size_t len = 0; @@ -828,13 +828,13 @@ int cvfprintf(CFILE *cfile, const char *format, va_list args) { case 'p': switch (*++i) { case 'P': - if (print_path(cfile, va_arg(args, struct BFTW *)) != 0) { + if (print_path(cfile, va_arg(args, const struct BFTW *)) != 0) { return -1; } break; case 'L': - if (print_link_target(cfile, va_arg(args, struct BFTW *)) != 0) { + if (print_link_target(cfile, va_arg(args, const struct BFTW *)) != 0) { return -1; } break; -- cgit v1.2.3