]> Sergey Matveev's repositories - public-inbox.git/commitdiff
githttpbackend: minor cleanups to improve readability
authorEric Wong <e@80x24.org>
Sun, 25 Dec 2016 07:33:02 +0000 (07:33 +0000)
committerEric Wong <e@80x24.org>
Sun, 25 Dec 2016 10:30:19 +0000 (10:30 +0000)
Fewer returns improves readability and the diffstat agrees.

lib/PublicInbox/GitHTTPBackend.pm

index 4ad3fd1ee3aca9ef0b3c44e3a9ac6598163ba825..1fa5e30ee03c3f370cc377d523711be6782aa9ba 100644 (file)
@@ -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) = @_;