summaryrefslogtreecommitdiffstats
path: root/color.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-05-05 15:46:55 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-05-05 22:56:27 -0400
commitdf7d960b0d7e1f9bd8aa58654760e41b6282f78a (patch)
tree9fc241b2fd0924cacc61c91eed8cb69b6874d764 /color.c
parent690d0467d1cb98247b72ee570dc49b225d63a5ec (diff)
downloadbfs-df7d960b0d7e1f9bd8aa58654760e41b6282f78a.tar.xz
bftw: Pass a const struct BFTW * to the callback
Diffstat (limited to 'color.c')
-rw-r--r--color.c12
1 files changed, 6 insertions, 6 deletions
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;