warn "BUG? <$$x> had no ^index line";
}
$$x =~ s!^diff --git!anchor1($ctx, $pb) // 'diff --git'!ems;
- my $dst = $ctx->{obuf};
- $$dst .= qq(<span\nclass="head">);
- $$dst .= $$x;
- $$dst .= '</span>';
+ $ctx->zmore(qq(<span\nclass="head">$$x</span>));
$dctx;
}
my $ch = $ctx->{changed_href} // '#related';
$$x .= qq(<a href="$ch">changed</a>,);
$$x .= ascii_html(pop @x); # $4: insertions/deletions
- $$x .= $lnk->to_html(pop @x); # notes, commit message, etc
+ # notes, commit message, etc
+ $ctx->zmore($$x .= $lnk->to_html(pop @x));
} else {
- $ctx->{-linkify}->to_html($$x);
+ $ctx->zmore($ctx->{-linkify}->to_html($$x));
}
}
my @top = split($EXTRACT_DIFFS, $$cur);
undef $$cur; # free memory
- my $linkify = $ctx->{-linkify};
- my $dst = $ctx->{obuf};
+ my $lnk = $ctx->{-linkify};
my $dctx; # {}, keys: Q, oid_a, oid_b
while (defined(my $x = shift @top)) {
if (!defined($dctx)) {
$after .= $s;
} elsif ($s =~ s/\A@@ (\S+) (\S+) @@//) {
- $$dst .= qq(<span\nclass="hunk">);
- $$dst .= diff_hunk($dctx, $1, $2);
- $$dst .= $linkify->to_html($s);
- $$dst .= '</span>';
- } elsif ($s =~ /\A\+/) {
- $$dst .= qq(<span\nclass="add">);
- $$dst .= $linkify->to_html($s);
- $$dst .= '</span>';
+ $ctx->zmore(qq(<span\nclass="hunk">) .
+ diff_hunk($dctx, $1, $2) .
+ $lnk->to_html($s) .
+ '</span>');
+ } elsif ($s =~ /\A\+/) { # $s may be huge
+ $ctx->zmore(qq(<span\nclass="add">),
+ $lnk->to_html($s),
+ '</span>');
} elsif ($s =~ /\A-- $/sm) { # email sig starts
$dctx = undef;
$after .= $s;
- } elsif ($s =~ /\A-/) {
- $$dst .= qq(<span\nclass="del">);
- $$dst .= $linkify->to_html($s);
- $$dst .= '</span>';
- } else {
- $$dst .= $linkify->to_html($s);
+ } elsif ($s =~ /\A-/) { # $s may be huge
+ $ctx->zmore(qq(<span\nclass="del">),
+ $lnk->to_html($s),
+ '</span>');
+ } else { # $s may be huge
+ $ctx->zmore($lnk->to_html($s));
}
}
- $$dst .= diff_before_or_after($ctx, \$after) if !$dctx;
+ diff_before_or_after($ctx, \$after) if !$dctx;
} else {
- $$dst .= diff_before_or_after($ctx, \$x);
+ diff_before_or_after($ctx, \$x);
}
}
}