]> Sergey Matveev's repositories - public-inbox.git/commitdiff
inbox: introduce smsg_eml method
authorEric Wong <e@yhbt.net>
Mon, 1 Jun 2020 10:06:45 +0000 (10:06 +0000)
committerEric Wong <e@yhbt.net>
Wed, 3 Jun 2020 04:04:21 +0000 (04:04 +0000)
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
lib/PublicInbox/SolverGit.pm

index c295b2677e48299cbfbacfc53f36136ad73f479f..bd1489e369947b5f13d3a1012ddbb7a4878cd892 100644 (file)
@@ -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;
index f718e28cbd55af423a4ad41d15c4e2a141ac55e2..b1cb1ae97c41ccd371a8387b13f5f379abd21418 100644 (file)
@@ -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;