From 30ac717281ae224a9c117361ca941818adc69cf3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 1 Jun 2020 10:06:45 +0000 Subject: [PATCH] inbox: introduce smsg_eml method The goal of this is to eventually remove the $smsg->{mime} field which is easy-to-misuse and cause memory explosions which necessitated fixes like commit 7d02b9e64455831d ("view: stop storing all MIME objects on large threads"). --- lib/PublicInbox/Inbox.pm | 6 ++++++ lib/PublicInbox/SolverGit.pm | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index c295b267..bd1489e3 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -334,6 +334,12 @@ sub smsg_mime { } } +sub smsg_eml { + my ($self, $smsg) = @_; + my $bref = msg_by_smsg($self, $smsg) or return; + PublicInbox::Eml->new($bref); +} + sub mid2num($$) { my ($self, $mid) = @_; my $mm = mm($self) or return; diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index f718e28c..b1cb1ae9 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -233,8 +233,8 @@ sub find_extract_diffs ($$$) { my $diffs = []; foreach my $smsg (@$msgs) { - $ibx->smsg_mime($smsg) or next; - delete($smsg->{mime})->each_part(\&extract_diff, + my $eml = $ibx->smsg_eml($smsg) or next; + $eml->each_part(\&extract_diff, [$self, $diffs, $pre, $post, $ibx, $smsg], 1); } @$diffs ? $diffs : undef; -- 2.48.1