commit a19a7820f9e0a489af58e7ec5c7869cf932fb982
parent 0122119a444617834b4b786cb2c1f1567fedeb0f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 21 Jan 2021 12:18:44 +0100
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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);