From a4f7622064f71c02102cb17fce0b4e67782059fc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 23 Aug 2015 20:05:41 +0000 Subject: cleanup calls to header_obj Dereference header_obj only once when performance may be critical, or simplify our code by calling "header" directly on the Email::{Simple,MIME} object if not. --- lib/PublicInbox/Mbox.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/Mbox.pm') diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 9af92793..719398f7 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -27,14 +27,15 @@ sub emit1 { sub emit_msg { my ($fh, $simple) = @_; # Email::Simple object + my $header_obj = $simple->header_obj; # drop potentially confusing headers, ssoma already should've dropped # Lines and Content-Length foreach my $d (qw(Lines Content-Length Status)) { - $simple->header_set($d); + $header_obj->header_set($d); } - my $buf = $simple->header_obj->as_string; + my $buf = $header_obj->as_string; unless ($buf =~ /\AFrom /) { $fh->write("From mboxrd\@z Thu Jan 1 00:00:00 1970\n"); } -- cgit v1.2.3-24-ge0c7