From a19a7820f9e0a489af58e7ec5c7869cf932fb982 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 21 Jan 2021 12:18:44 +0100 Subject: [PATCH] color: recompile the file-probing regexes a little faster with REG_NOSUB When the filename, header-line, and magic regexes are first compiled while reading in the rc files (to check their validity), REG_NOSUB is used, but for some reason this wasn't done when each of these regexes gets recompiled in order to be used. Fix this oversight. It shaves some twenty percent off of each of these regexes' compiling time. --- src/color.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/color.c b/src/color.c index 6f1cbc9d..bc5c2529 100644 --- a/src/color.c +++ b/src/color.c @@ -120,7 +120,7 @@ bool found_in_list(regexlisttype *head, const char *shibboleth) regex_t rgx; for (item = head; item != NULL; item = item->next) { - regcomp(&rgx, item->full_regex, NANO_REG_EXTENDED); + regcomp(&rgx, item->full_regex, NANO_REG_EXTENDED | REG_NOSUB); if (regexec(&rgx, shibboleth, 0, NULL, 0) == 0) { regfree(&rgx);