From bf97faf32ad09c4e13c20cfcdae452dfd91a7baf Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 22 May 2021 07:48:12 +0300 Subject: [PATCH] os: simplify os.read_bytes_into_newline to fix compilation on freebsd --- vlib/os/file.c.v | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/os/file.c.v b/vlib/os/file.c.v index 65ecb838cc..39d0b6502b 100644 --- a/vlib/os/file.c.v +++ b/vlib/os/file.c.v @@ -376,14 +376,15 @@ pub fn (f &File) read_bytes_into_newline(mut buf []byte) ?int { mut buf_ptr := 0 mut nbytes := 0 + stream := &C.FILE(f.cfile) for (buf_ptr < buf.len) { - c = C.getc(f.cfile) + c = C.getc(stream) match c { C.EOF { - if C.feof(f.cfile) != 0 { + if C.feof(stream) != 0 { return nbytes } - if C.ferror(f.cfile) != 0 { + if C.ferror(stream) != 0 { return error('file read error') } }