You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/11/14 01:49:58 UTC
svn commit: rev 65558 - spamassassin/trunk/lib/Mail/SpamAssassin
Author: jm
Date: Sat Nov 13 16:49:57 2004
New Revision: 65558
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
Log:
fix a slight speed decrease from the new dbg_check() call
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Sat Nov 13 16:49:57 2004
@@ -100,6 +100,12 @@
$self->{pattern_hits} = { };
}
+ delete $self->{should_log_rule_hits};
+ my $dbgcache = Mail::SpamAssassin::dbg_check('rules');
+ if ($dbgcache || $self->{save_pattern_hits}) {
+ $self->{should_log_rule_hits} = 1;
+ }
+
bless ($self, $class);
$self;
}
@@ -1462,22 +1468,19 @@
sub ran_rule_debug_code {
my ($self, $rulename, $ruletype, $bit) = @_;
- my $dbgcache = Mail::SpamAssassin::dbg_check('rules');
- return '' if (!$dbgcache && !$self->{save_pattern_hits});
+ return '' unless exists($self->{should_log_rule_hits});
- my $log_hits_code = '';
- my $save_hits_code = '';
-
- if ($dbgcache) {
- # note: keep this in 'single quotes' to avoid the $ & performance hit,
- # unless specifically requested by the caller.
- $log_hits_code = ': match=\'$&\'';
- }
+ # note: keep this in 'single quotes' to avoid the $ & performance hit,
+ # unless specifically requested by the caller. Also split the
+ # two chars, just to be paranoid and ensure that a buggy perl interp
+ # doesn't impose that hit anyway (just in case)
+ my $log_hits_code = ': match=\'$' . '&\'';
+ my $save_hits_code = '';
if ($self->{save_pattern_hits}) {
$save_hits_code = '
- $self->{pattern_hits}->{q{'.$rulename.'}} = $&;
+ $self->{pattern_hits}->{q{'.$rulename.'}} = $' . '&;
';
}