Special case more simple patterns

fnmatch is slow, so avoiding it in more cases is good.  This implements
a more generic version of match_simple_wild which needs some
pre-processing of patterns.  In particular it supports patterns of the
form PREFIX*SUFFIX (where all parts are optional), i.e. a super set of
what's handled now.  Most section matchers of this form and hence don't
need any calls to fnmatch anymore.

We retain the implementation of match_simple_wild for the filename
matchers (they aren't called often enough to matter).
This commit is contained in:
Michael Matz
2022-11-22 15:24:14 +01:00
parent 4a6bdfb9ba
commit 049522cae9
2 changed files with 95 additions and 33 deletions

View File

@@ -98,8 +98,9 @@ struct wildcard_spec
{
const char *name;
struct name_list *exclude_name_list;
sort_type sorted;
struct flag_info *section_flag_list;
size_t namelen, prefixlen, suffixlen;
sort_type sorted;
};
struct wildcard_list