You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2009/08/25 21:57:03 UTC

svn commit: r807784 - in /spamassassin/trunk/lib/Mail: SpamAssassin.pm SpamAssassin/Conf.pm

Author: mmartinec
Date: Tue Aug 25 19:57:03 2009
New Revision: 807784

URL: http://svn.apache.org/viewvc?rev=807784&view=rev
Log:
Get rid of undef warnings during timing report,
document a tag TIMING and the two newly added tags

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin.pm?rev=807784&r1=807783&r2=807784&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin.pm Tue Aug 25 19:57:03 2009
@@ -1555,17 +1555,23 @@
 sub timer_report {
   my ($self) = @_;
 
-  my $earliest = undef;
-  my $latest = undef;
-  foreach my $t (values %{$self->{timers}}) {
-    if (!defined($earliest) || $earliest > $t->{start}) {
-      $earliest = $t->{start};
-    }
-    if (!defined($latest) || $latest < $t->{end}) {
-      $latest = $t->{end};
+  my $earliest;
+  my $latest;
+
+  while (my($name,$h) = each(%{$self->{timers}})) {
+  # dbg("timing: %s - %s", $name, join(", ",
+  #     map { sprintf("%s => %s", $_, $h->{$_}) } keys(%$h)));
+    my $start = $h->{start};
+    if (defined $start && (!defined $earliest || $earliest > $start)) {
+      $earliest = $start;
+    }
+    my $end = $h->{end};
+    if (defined $end && (!defined $latest || $latest < $end)) {
+      $latest = $end;
     }
   }
-  my $total = $latest - $earliest;
+  my $total =
+    (!defined $latest || !defined $earliest) ? 0 : $latest - $earliest;
   my @str;
   foreach my $name (@{$self->{timers_order}}) {
     my $elapsed = $self->{timers}->{$name}->{elapsed} || 0;

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm?rev=807784&r1=807783&r2=807784&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Tue Aug 25 19:57:03 2009
@@ -3177,6 +3177,9 @@
  _CONTACTADDRESS_  contents of the 'report_contact' setting
  _HEADER(NAME)_    includes the value of a message header.  value is the same
                    as is found for header rules (see elsewhere in this doc)
+ _TIMING_          timing breakdown report
+ _ADDEDHEADERHAM_  resulting header fields as requested by add_header for spam
+ _ADDEDHEADERSPAM_ resulting header fields as requested by add_header for ham
 
 If a tag reference uses the name of a tag which is not in this list or defined
 by a loaded plugin, the reference will be left intact and not replaced by any