]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/View.pm
view: eml_entry: reduce manipulation of ctx->{obuf}
[public-inbox.git] / lib / PublicInbox / View.pm
index 3980ed9177a692863e58926e1f9d78615f1ca304..37b484ae297ddff988ef7be93a16e502e2fdce23 100644 (file)
@@ -246,11 +246,11 @@ sub eml_entry {
        $ctx->{mhref} = $mhref;
        $ctx->{changed_href} = "#e$id"; # for diffstat "files? changed,"
        $ctx->{obuf} = \$rv;
-       $eml->each_part(\&add_text_body, $ctx, 1);
-       delete $ctx->{obuf};
+       $eml->each_part(\&add_text_body, $ctx, 1); # expensive
+       $ctx->zmore; # TODO: remove once add_text_body is updated
 
        # add the footer
-       $rv .= "\n<a\nhref=#$id_m\nid=e$id>^</a> ".
+       $rv = "\n<a\nhref=#$id_m\nid=e$id>^</a> ".
                "<a\nhref=\"$mhref\">permalink</a>" .
                " <a\nhref=\"${mhref}raw\">raw</a>" .
                " <a\nhref=\"${mhref}#R\">reply</a>";
@@ -388,7 +388,8 @@ sub pre_thread  { # walk_thread callback
 sub thread_eml_entry {
        my ($ctx, $eml) = @_;
        my ($beg, $end) = thread_adj_level($ctx, $ctx->{level});
-       $beg . '<pre>' . eml_entry($ctx, $eml) . '</pre>' . $end;
+       $ctx->zmore($beg.'<pre>');
+       eml_entry($ctx, $eml) . '</pre>' . $end;
 }
 
 sub next_in_queue ($$) {