about summary refs log tree commit homepage
path: root/lib/PublicInbox/Gcf2.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-17 23:37:52 +0000
committerEric Wong <e@80x24.org>2023-10-18 20:50:24 +0000
commit19b791f4894efcb6e545a6b51c8147298363358f (patch)
tree16a806fcb0c8fdaef242a2d268a8b1416809b46f /lib/PublicInbox/Gcf2.pm
parent35b0f7aa00a24f5d89b1b941ec644327ba074c99 (diff)
downloadpublic-inbox-19b791f4894efcb6e545a6b51c8147298363358f.tar.gz
`readline' ops may not detect errors on partial reads.
This saves us some code to reduce cognitive overhead for
readers.  We'll also support reusing a destination buffers so it
can work more nicely with existing code.
Diffstat (limited to 'lib/PublicInbox/Gcf2.pm')
-rw-r--r--lib/PublicInbox/Gcf2.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/Gcf2.pm b/lib/PublicInbox/Gcf2.pm
index 37262e28..4f163cde 100644
--- a/lib/PublicInbox/Gcf2.pm
+++ b/lib/PublicInbox/Gcf2.pm
@@ -9,7 +9,7 @@ use PublicInbox::Spawn qw(which popen_rd); # may set PERL_INLINE_DIRECTORY
 use Fcntl qw(SEEK_SET);
 use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
 use IO::Handle; # autoflush
-use PublicInbox::Git;
+use PublicInbox::Git qw(read_all);
 use PublicInbox::Lock;
 
 BEGIN {
@@ -43,12 +43,11 @@ BEGIN {
                 # build them.
                 my $f = "$dir/gcf2_libgit2.h";
                 open my $src, '<', $f;
-                local $/;
-                $c_src = <$src> // die "read $f: $!";
+                $c_src = read_all($src);
         }
         unless ($c_src) {
                 seek($err, 0, SEEK_SET);
-                $err = do { local $/; <$err> };
+                $err = read_all($err);
                 die "E: libgit2 not installed: $err\n";
         }
         # append pkg-config results to the source to ensure Inline::C