You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by pa...@apache.org on 2004/10/07 21:43:30 UTC

svn commit: rev 54009 - spamassassin/branches/3.0/lib/Mail/SpamAssassin

Author: parker
Date: Thu Oct  7 12:43:29 2004
New Revision: 54009

Modified:
   spamassassin/branches/3.0/lib/Mail/SpamAssassin/Bayes.pm
Log:
Bug 3875: Remove map/grep combo and replace with foreach loop to avoid odd memory bloat issue

Modified: spamassassin/branches/3.0/lib/Mail/SpamAssassin/Bayes.pm
==============================================================================
--- spamassassin/branches/3.0/lib/Mail/SpamAssassin/Bayes.pm	(original)
+++ spamassassin/branches/3.0/lib/Mail/SpamAssassin/Bayes.pm	Thu Oct  7 12:43:29 2004
@@ -355,7 +355,11 @@
 
   # Go ahead and uniq the array, skip null tokens (can happen sometimes)
   # generate an SHA1 hash and take the lower 40 bits as our token
-  my %tokens = map { substr(sha1($_), -5) => { 'raw_token' => $_ } } grep(length, @tokens);
+  my %tokens;
+  foreach my $token (@tokens) {
+    next unless length($token); # skip 0 length tokens
+    $tokens{substr(sha1($token), -5)} = { 'raw_token' => $token };
+  }
 
   # return the keys == tokens ...
   return \%tokens;