]> Sergey Matveev's repositories - public-inbox.git/commitdiff
githttpbackend: avoid intermediate array creation from stat
authorEric Wong <e@80x24.org>
Thu, 7 Jul 2016 01:39:34 +0000 (01:39 +0000)
committerEric Wong <e@80x24.org>
Thu, 7 Jul 2016 01:41:01 +0000 (01:41 +0000)
No need to keep an extra array around for this.

lib/PublicInbox/GitHTTPBackend.pm

index a9c0e9c7e985bd12f8f7c2474699f911b6dac29a..b684988d06b18edba847c1641874caff6cc01664 100644 (file)
@@ -96,8 +96,7 @@ sub serve_dumb {
 
        my $f = (ref $git ? $git->{git_dir} : $git) . '/' . $path;
        return r(404) unless -f $f && -r _; # just in case it's a FIFO :P
-       my @st = stat(_);
-       my $size = $st[7];
+       my $size = -s _;
 
        # TODO: If-Modified-Since and Last-Modified?
        open my $in, '<', $f or return r(404);