about summary refs log tree commit homepage
path: root/lib/PublicInbox/Feed.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-08-24 02:25:46 +0000
committerEric Wong <e@80x24.org>2015-08-24 09:29:00 +0000
commit71040e5ff8a68eb0cfaf20c273e227cdceb9dc23 (patch)
tree6dcdeff527049c7c98fa7ec347b0afb26eae41db /lib/PublicInbox/Feed.pm
parent94f2f2bd84a3569912cc27b42c21b67917333f58 (diff)
downloadpublic-inbox-71040e5ff8a68eb0cfaf20c273e227cdceb9dc23.tar.gz
Using hash means we no longer have to document and remember what
every field does.  The original array form was insane premature
optimization and crazy.  Who wrote that?  Oh wait, I was on
drugs :<
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r--lib/PublicInbox/Feed.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index f4d19e02..969fc110 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -89,7 +89,12 @@ sub emit_html_index {
         $srch and $topics = [ [], {} ];
         my (undef, $last) = each_recent_blob($ctx, sub {
                 my ($path, $commit, $ts, $u, $subj) = @_;
-                $state ||= [ undef, {}, $commit, 0 ];
+                $state ||= {
+                        ctx => $ctx,
+                        seen => {},
+                        first_commit => $commit,
+                        anchor_idx => 0,
+                };
 
                 if ($srch) {
                         add_topic($git, $srch, $topics, $path, $ts, $u, $subj);
@@ -119,9 +124,8 @@ sub nav_footer {
         my $old_r = $cgi->param('r');
         my $head = '    ';
         my $next = '    ';
-        # $state = [ undef, {}, $first_commit, $last_anchor ];
-        my $first = $state->[2];
-        my $anchor = $state->[3];
+        my $first = $state->{first_commit};
+        my $anchor = $state->{anchor_idx};
 
         if ($last) {
                 $next = qq!<a\nhref="?r=$last">next</a>!;