mirror of
https://github.com/curl/curl.git
synced 2026-04-15 01:05:56 +08:00
badwords: twice as fast
...on my macOS machine, this version uses half the time when scanning the source. Closes #20877
This commit is contained in:
parent
8ec0e1e109
commit
c1cea52f12
@ -73,15 +73,15 @@ while(<STDIN>) {
|
||||
# Build a single combined regex for case-insensitive words
|
||||
my $re_ci;
|
||||
if(@w) {
|
||||
my $pat = join('|', map { '\b'.quotemeta($_).'\b' } @w);
|
||||
$re_ci = qr/($pat)/i;
|
||||
my $pat = join('|', map { quotemeta($_) } @w);
|
||||
$re_ci = qr/\b($pat)\b/i;
|
||||
}
|
||||
|
||||
# Build a single combined regex for case-sensitive (exact) words
|
||||
my $re_cs;
|
||||
if(@exact) {
|
||||
my $pat = join('|', map { '\b'.quotemeta($_).'\b' } @exact);
|
||||
$re_cs = qr/($pat)/;
|
||||
my $pat = join('|', map { quotemeta($_) } @exact);
|
||||
$re_cs = qr/\b($pat)\b/;
|
||||
}
|
||||
|
||||
my $errors = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user