You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2022/05/14 06:58:58 UTC
svn commit: r1900873 - /spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm
Author: hege
Date: Sat May 14 06:58:57 2022
New Revision: 1900873
URL: http://svn.apache.org/viewvc?rev=1900873&view=rev
Log:
Small code cleanup
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm?rev=1900873&r1=1900872&r2=1900873&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm Sat May 14 06:58:57 2022
@@ -660,28 +660,25 @@ sub do_head_tests {
loop_body => sub
{
my ($self, $pms, $conf, $rulename, $pat, %opts) = @_;
+
+ push @{$ordered{
+ $conf->{test_opt_header}->{$rulename} .
+ (!exists $conf->{test_opt_unset}->{$rulename} ? '' : "\t$rulename")
+ }}, $rulename;
+
+ return if ($opts{doing_user_rules} &&
+ !$self->is_user_rule_sub($rulename.'_head_test'));
+
my ($op, $op_infix);
- my $hdrname = $conf->{test_opt_header}->{$rulename};
if (exists $conf->{test_opt_exists}->{$rulename}) {
$op_infix = 0;
- if (exists $conf->{test_opt_neg}->{$rulename}) {
- $op = '!defined';
- } else {
- $op = 'defined';
- }
+ $op = exists $conf->{test_opt_neg}->{$rulename} ? '!defined' : 'defined';
}
else {
$op_infix = 1;
- $op = $conf->{test_opt_neg}->{$rulename} ? '!~' : '=~';
+ $op = exists $conf->{test_opt_neg}->{$rulename} ? '!~' : '=~';
}
- my $def = $conf->{test_opt_unset}->{$rulename};
- push(@{ $ordered{$hdrname . (!defined $def ? '' : "\t$rulename")} },
- $rulename);
-
- return if ($opts{doing_user_rules} &&
- !$self->is_user_rule_sub($rulename.'_head_test'));
-
$testcode{$rulename} = [$op_infix, $op, $pat];
},
pre_loop_body => sub
@@ -729,11 +726,7 @@ sub do_head_tests {
$whlast = 'last if ++$hits >= '.untaint_var($1).';';
}
}
- if ($matchg) {
- $expr = '$hval '.$op.' /$qrptr->{q{'.$rulename.'}}/gop';
- } else {
- $expr = '$hval '.$op.' /$qrptr->{q{'.$rulename.'}}/op';
- }
+ $expr = '$hval '.$op.' /$qrptr->{q{'.$rulename.'}}/'.$matchg.'op';
}
# Make sure rule is marked ready for meta rules using $hitsptr