]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
convert: use read_all to simplify error checks
authorEric Wong <e@80x24.org>
Tue, 17 Oct 2023 23:38:14 +0000 (23:38 +0000)
committerEric Wong <e@80x24.org>
Wed, 18 Oct 2023 20:50:43 +0000 (20:50 +0000)
There wasn't a need to loop anyways with Perl `read' since
the default PerlIO layer will retry.

script/public-inbox-convert

index 0cc52777641eebd03e23ef29a7a4a2e7e65aecde..96f6d2ea018f4e11d21b7cbb45dd09ce076288ac 100755 (executable)
@@ -130,14 +130,8 @@ while (<$rd>) {
        } elsif (/^commit /) {
                $state = 'commit';
        } elsif (/^data ([0-9]+)/) {
-               my $len = $1;
                print $io $_ or $im->wfail;
-               while ($len) {
-                       my $n = read($rd, my $tmp, $len) or die "read: $!";
-                       warn "$n != $len\n" if $n != $len;
-                       $len -= $n;
-                       print $io $tmp or $im->wfail;
-               }
+               print $io PublicInbox::Git::read_all($rd, $1) or $im->wfail;
                next;
        } elsif ($state eq 'commit') {
                if (m{^M 100644 :([0-9]+) (${h}{2}/${h}{38})}o) {