diff options
author | Eric Wong <e@80x24.org> | 2021-10-09 12:03:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-10-09 21:31:05 +0000 |
commit | 17c6b04327bac7debf5dbfa633a8fbdf3cd96873 (patch) | |
tree | 4499bb460287db13739852a9b2608647b1cde28a /lib/PublicInbox/SolverGit.pm | |
parent | 9f64411551e971251d17b3d346a7f250df5ef350 (diff) | |
download | public-inbox-17c6b04327bac7debf5dbfa633a8fbdf3cd96873.tar.gz |
Some of these scalar buffers may be large patches, so try to keep them as short-lived as possible to reduce memory pressure.
Diffstat (limited to 'lib/PublicInbox/SolverGit.pm')
-rw-r--r-- | lib/PublicInbox/SolverGit.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index b0cd0f2c..5d5060f4 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -111,8 +111,6 @@ sub extract_diff ($$) { my ($self, $want, $smsg) = @$arg; my ($part) = @$p; # ignore $depth and @idx; my $ct = $part->content_type || 'text/plain'; - my ($s, undef) = msg_part_text($part, $ct); - defined $s or return; my $post = $want->{oid_b}; my $pre = $want->{oid_a}; if (!defined($pre) || $pre !~ /\A[a-f0-9]+\z/) { @@ -122,11 +120,12 @@ sub extract_diff ($$) { # Email::MIME::Encodings forces QP to be CRLF upon decoding, # change it back to LF: my $cte = $part->header('Content-Transfer-Encoding') || ''; + my ($s, undef) = msg_part_text($part, $ct); + defined $s or return; + delete $part->{bdy}; if ($cte =~ /\bquoted-printable\b/i && $part->crlf eq "\n") { $s =~ s/\r\n/\n/sg; } - - $s =~ m!( # $1 start header lines we save for debugging: # everything before ^index is optional, but we don't @@ -169,6 +168,7 @@ sub extract_diff ($$) { # because git-apply(1) handles that case, too (?:^(?:[\@\+\x20\-\\][^\n]*|)$LF)+ )!smx or return; + undef $s; # free memory my $di = { hdr_lines => $1, |