From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1C024206FB for ; Thu, 7 Jul 2016 01:50:21 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/4] githttpbackend: avoid intermediate array creation from stat Date: Thu, 7 Jul 2016 01:50:16 +0000 Message-Id: <20160707015019.16974-2-e@80x24.org> In-Reply-To: <20160707015019.16974-1-e@80x24.org> References: <20160707015019.16974-1-e@80x24.org> List-Id: No need to keep an extra array around for this. --- lib/PublicInbox/GitHTTPBackend.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm index a9c0e9c..b684988 100644 --- a/lib/PublicInbox/GitHTTPBackend.pm +++ b/lib/PublicInbox/GitHTTPBackend.pm @@ -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); -- EW