From 3b82c88d1950291b1b703f082df43ec1b9654eb5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 5 Feb 2024 14:11:38 -0500 Subject: color: New API to check if stat() is necessary --- src/color.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/color.c') diff --git a/src/color.c b/src/color.c index 1f10c04..8c32a68 100644 --- a/src/color.c +++ b/src/color.c @@ -764,6 +764,11 @@ static bool is_link_broken(const struct BFTW *ftwbuf) { } } +bool colors_need_stat(const struct colors *colors) { + return colors->setuid || colors->setgid || colors->executable || colors->multi_hard + || colors->sticky_other_writable || colors->other_writable || colors->sticky; +} + /** Get the color for a file. */ static const struct esc_seq *file_color(const struct colors *colors, const char *filename, const struct BFTW *ftwbuf, enum bfs_stat_flags flags) { enum bfs_type type = bftw_type(ftwbuf, flags); -- cgit v1.2.3