https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6686

             Bug #: 6686
           Summary: Allow Mail::SpamAssassin::parser to accept $message
                    also as a string ref, saves a copy and memory
           Product: Spamassassin
           Version: 3.4.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Libraries
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


Created attachment 4992
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=4992
suggested patch

Here is one trivial enhancement to Mail::SpamAssassin::Message->new
to let it also accept a message as a ref to a string, besides the
usual string / array ref / glob.  If a caller already has a message
prepared in memory as a string, passing a ref to it instead of
copying a message saves one message copy operation and eliminates
one message copy in memory for the duration of a mail check.

Currently planned to be used by amavisd for small messages
(large messages are passed as GLOB).  Can't hurt to add some
extra flexibility at no cost.

Essentially what it does is:

+  elsif (ref $message eq 'SCALAR') {
+    @message = split(/^/m, $$message, -1);
+  }
in addition to:
  elsif (defined $message) {
    @message = split(/^/m, $message, -1);
  }

The rest of the patch is just a documentation change.

-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to