1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: simplify os.read_bytes_into_newline to fix compilation on freebsd

This commit is contained in:
Delyan Angelov 2021-05-22 07:48:12 +03:00
parent b7bf4b034e
commit bf97faf32a
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -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')
}
}