From: Stefan Eissing Date: Tue, 10 Mar 2026 13:48:49 +0000 (+0100) Subject: badwords: twice as fast X-Git-Tag: curl-8_19_0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1cea52f12c177be8226d8e11b256b514b68ac45;p=thirdparty%2Fcurl.git badwords: twice as fast ...on my macOS machine, this version uses half the time when scanning the source. Closes #20877 --- diff --git a/scripts/badwords b/scripts/badwords index 149150ef23..9c45574636 100755 --- a/scripts/badwords +++ b/scripts/badwords @@ -73,15 +73,15 @@ while() { # 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;