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:
parent
b7bf4b034e
commit
bf97faf32a
@ -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')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user