Skip to content

Commit 5a4d2cb

Browse files
committed
perf: Add special case for pattern equal to "*"
Don't recurse needlessly in this case.
1 parent 4b0170f commit 5a4d2cb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Meta/Filters/ModulesBlacklist.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ class ModulesBlacklist {
7272
// If we reach at the end of both strings, we are done
7373
if (*pattern == '\0' && *string == '\0')
7474
return true;
75-
75+
76+
// pattern "*" matches everything, done checking
77+
if (pattern[0] == '*' && pattern[1] == '\0')
78+
return true;
79+
7680
// Make sure that the characters after '*' are present
7781
// in second string. This function assumes that the first
7882
// string will not contain two consecutive '*'

0 commit comments

Comments
 (0)