From 9bb0dab1200c2dd1bbee6e54c9364c5d9af86921 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Tue, 19 May 2009 14:45:16 +0000 Subject: [PATCH] check_for_forbidden_characters() cosmetics: - Don't unnecessarily escape '?' and '/' inside the character class. - Use a more appropriate variable name. - Compile the regex only once. While it doesn't matter, it doesn't hurt either. --- tools/privoxy-regression-test.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/privoxy-regression-test.pl b/tools/privoxy-regression-test.pl index ae5fa9a3..902b61bb 100755 --- a/tools/privoxy-regression-test.pl +++ b/tools/privoxy-regression-test.pl @@ -7,7 +7,7 @@ # A regression test "framework" for Privoxy. For documentation see: # perldoc privoxy-regression-test.pl # -# $Id: privoxy-regression-test.pl,v 1.170 2009/05/15 20:25:51 fk Exp $ +# $Id: privoxy-regression-test.pl,v 1.171 2009/05/19 14:34:49 fk Exp $ # # Wish list: # @@ -140,14 +140,14 @@ sub parse_tag ($) { sub check_for_forbidden_characters ($) { - my $tag = shift; # XXX: also used to check values though. - my $allowed = '[-=\dA-Za-z~{}:.\/();\s,+@"_%\?&*^]'; + my $string = shift; + my $allowed = '[-=\dA-Za-z~{}:./();\s,+@"_%?&*^]'; - unless ($tag =~ m/^$allowed*$/) { - my $forbidden = $tag; + unless ($string =~ m/^$allowed*$/o) { + my $forbidden = $string; $forbidden =~ s@^$allowed*(.).*@$1@; - l(LL_ERROR, "'" . $tag . "' contains character '" . $forbidden. "' which is unacceptable."); + l(LL_ERROR, "'" . $string . "' contains character '" . $forbidden. "' which is unacceptable."); } } -- 2.39.2