From c47247dfdee80a8ad68039df7b95d3e900e31b54 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 21 Jan 2017 04:35:27 +0000 Subject: repobrowse: avoid extra hash assignments for Atom feed This should make the code somewhat easier-to-follow. --- lib/PublicInbox/RepobrowseGitAtom.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/RepobrowseGitAtom.pm b/lib/PublicInbox/RepobrowseGitAtom.pm index 99d79869..f851ee36 100644 --- a/lib/PublicInbox/RepobrowseGitAtom.pm +++ b/lib/PublicInbox/RepobrowseGitAtom.pm @@ -32,8 +32,8 @@ sub repo_root_url { PublicInbox::Repobrowse::base_url($env) . join('/', @uri); } -sub flush_hdr ($$) { - my ($dst, $hdr) = @_; +sub flush_hdr ($$$) { + my ($dst, $hdr, $url) = @_; $$dst .= ''; $$dst .= utf8_html($hdr->{'s'}); # commit subject $$dst .= ''; @@ -46,8 +46,9 @@ sub flush_hdr ($$) { $$dst .= strftime(DATEFMT, gmtime($hdr->{at})); $$dst .= ''; $$dst .= qq(); @@ -73,7 +74,7 @@ sub git_atom_sed ($$) { my $title = join('/', $repo_info->{repo}, @{$req->{extra}}); $title = utf8_html("$title, branch $req->{q}->{h}"); my $url = repo_root_url($self, $req); - my $hdr = $req->{hdr} = { url => $url }; + my $hdr = {}; $req->{axml} = qq(\n) . qq() . qq($title) . @@ -100,8 +101,8 @@ sub git_atom_sed ($$) { if ($state != STATE_BODY) { $hdr->{((STATES)[$state])} = $l; if (++$state == STATE_BODY) { - flush_hdr(\$dst, $hdr); - %$hdr = (url => $url); + flush_hdr(\$dst, $hdr, $url); + $hdr = {}; } next; } -- cgit v1.2.3-24-ge0c7