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 B6C3220756 for ; Sun, 25 Dec 2016 10:36:56 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/4] githttpbackend: minor cleanups to improve readability Date: Sun, 25 Dec 2016 10:36:52 +0000 Message-Id: <20161225103653.8325-4-e@80x24.org> In-Reply-To: <20161225103653.8325-1-e@80x24.org> References: <20161225103653.8325-1-e@80x24.org> List-Id: Fewer returns improves readability and the diffstat agrees. --- lib/PublicInbox/GitHTTPBackend.pm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm index 4ad3fd1..1fa5e30 100644 --- a/lib/PublicInbox/GitHTTPBackend.pm +++ b/lib/PublicInbox/GitHTTPBackend.pm @@ -225,7 +225,6 @@ sub serve_smart { }; my $res; my $async = $env->{'pi-httpd.async'}; # XXX unstable API - my $io = $env->{'psgix.io'}; my $cb = sub { my $r = $rd_hdr->() or return; $rd_hdr = undef; @@ -236,17 +235,16 @@ sub serve_smart { $rpipe->close; $end->(); } - return $res->($r); - } - if ($async) { + $res->($r); + } elsif ($async) { $fh = $res->($r); - return $async->async_pass($io, $fh, \$buf); + $async->async_pass($env->{'psgix.io'}, $fh, \$buf); + } else { # for synchronous PSGI servers + require PublicInbox::GetlineBody; + $r->[2] = PublicInbox::GetlineBody->new($rpipe, $end, + $buf); + $res->($r); } - - # for synchronous PSGI servers - require PublicInbox::GetlineBody; - $r->[2] = PublicInbox::GetlineBody->new($rpipe, $end, $buf); - $res->($r); }; sub { ($res) = @_; -- EW