]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: minor cleanups to shorten code
authorEric Wong <e@80x24.org>
Thu, 27 Aug 2015 04:33:58 +0000 (04:33 +0000)
committerEric Wong <e@80x24.org>
Thu, 27 Aug 2015 06:04:51 +0000 (06:04 +0000)
Less scrolling is more efficient.

lib/PublicInbox/WWW.pm

index d1ee2ff07340a8cfac4b1daafaf56898424af805..527d2131a27f894c9e68678e53a34318508a674d 100644 (file)
@@ -138,7 +138,6 @@ sub mid2blob {
        my $path = PublicInbox::MID::mid2path($ctx->{mid});
        my @cmd = ('git', "--git-dir=$ctx->{git_dir}",
                        qw(cat-file blob), "HEAD:$path");
-       my $cmd = join(' ', @cmd);
        my $pid = open my $fh, '-|';
        defined $pid or die "fork failed: $!\n";
        if ($pid == 0) {
@@ -162,8 +161,7 @@ sub get_mid_txt {
 # /$LISTNAME/m/$MESSAGE_ID.html                   -> HTML content (short quotes)
 sub get_mid_html {
        my ($ctx) = @_;
-       my $x = mid2blob($ctx);
-       return r404() unless $x;
+       my $x = mid2blob($ctx) or return r404();
 
        require PublicInbox::View;
        my $pfx = msg_pfx($ctx);
@@ -178,8 +176,8 @@ sub get_mid_html {
 # /$LISTNAME/f/$MESSAGE_ID.html                   -> HTML content (fullquotes)
 sub get_full_html {
        my ($ctx) = @_;
-       my $x = mid2blob($ctx);
-       return r404() unless $x;
+       my $x = mid2blob($ctx) or return r404();
+
        require PublicInbox::View;
        my $foot = footer($ctx);
        require Email::MIME;