diff options
author | Eric Wong <e@80x24.org> | 2023-10-17 23:37:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-18 20:50:24 +0000 |
commit | 19b791f4894efcb6e545a6b51c8147298363358f (patch) | |
tree | 16a806fcb0c8fdaef242a2d268a8b1416809b46f /lib/PublicInbox/Gcf2.pm | |
parent | 35b0f7aa00a24f5d89b1b941ec644327ba074c99 (diff) | |
download | public-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.pm | 7 |
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 |