From: Pádraig Brady Date: Mon, 14 Feb 2022 17:25:04 +0000 (+0000) Subject: dircolors: speed up processing of TERM entries X-Git-Tag: v9.1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=041dfff5db1f09c92435e46b65931b04364c37f6;p=thirdparty%2Fcoreutils.git dircolors: speed up processing of TERM entries * src/dircolors.c (main): Avoid glob matching when we've already matched in a group of {COLOR,}TERM entries. --- diff --git a/src/dircolors.c b/src/dircolors.c index 5c92299621..f8e2f549f0 100644 --- a/src/dircolors.c +++ b/src/dircolors.c @@ -328,17 +328,13 @@ dc_parse_stream (FILE *fp, char const *filename) unrecognized = false; if (c_strcasecmp (keywd, "TERM") == 0) { - if (fnmatch (arg, term, 0) == 0) - state = ST_TERMSURE; - else if (state != ST_TERMSURE) - state = ST_TERMNO; + if (state != ST_TERMSURE) + state = fnmatch (arg, term, 0) == 0 ? ST_TERMSURE : ST_TERMNO; } else if (c_strcasecmp (keywd, "COLORTERM") == 0) { - if (fnmatch (arg, colorterm, 0) == 0) - state = ST_TERMSURE; - else if (state != ST_TERMSURE) - state = ST_TERMNO; + if (state != ST_TERMSURE) + state = fnmatch (arg, colorterm, 0) == 0 ? ST_TERMSURE : ST_TERMNO; } else {