From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B66FC1FA09 for ; Mon, 1 Jun 2020 10:06:57 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 01/13] inbox: introduce smsg_eml method Date: Mon, 1 Jun 2020 10:06:45 +0000 Message-Id: <20200601100657.14700-2-e@yhbt.net> In-Reply-To: <20200601100657.14700-1-e@yhbt.net> References: <20200601100657.14700-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 c295b2677e4..bd1489e3699 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 f718e28cbd5..b1cb1ae97c4 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;