From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2B61E1FA5F for ; Tue, 17 Oct 2023 23:38:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1697585901; bh=7kUCw/9oNVC5eBlOLDQo5qIxBy0viBoKkfFbcMNYgm8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sogRSWrhYoZYl8Nngdp4R8/emq02AkQlzKcCFqaqCdzvxXI8D+8a0H9jp8lHFHbrK KhHR0DS4rwgnbm9yvORpqvNfEa2RBoOoE3j4lKbkkpU/bX99DLz9Ge1OI5E5GWWbCb JPANH0ICJic/65U6xx5rGPy6O13daPkWp9L9s2Fw= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 29/30] convert: use read_all to simplify error checks Date: Tue, 17 Oct 2023 23:38:14 +0000 Message-ID: <20231017233815.1637932-30-e@80x24.org> In-Reply-To: <20231017233815.1637932-1-e@80x24.org> References: <20231017233815.1637932-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: There wasn't a need to loop anyways with Perl `read' since the default PerlIO layer will retry. --- script/public-inbox-convert | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/script/public-inbox-convert b/script/public-inbox-convert index 0cc52777..96f6d2ea 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -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) {