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

os: fix get_raw_line() + minor v2 fixes

This commit is contained in:
Alexander Medvednikov
2020-02-28 14:05:20 +01:00
parent c4b9ef388f
commit 7f5a15372f
6 changed files with 31 additions and 13 deletions

View File

@@ -704,14 +704,15 @@ pub fn get_raw_line() string {
}
} $else {
max := size_t(0)
mut buf := byteptr(0)
nr_chars := C.getline(&charptr(buf), &max, stdin)
defer { unsafe{ free(buf) } }
mut buf := charptr(0)
nr_chars := C.getline(&buf, &max, stdin)
//defer { unsafe{ free(buf) } }
if nr_chars == 0 || nr_chars == -1 {
return ''
}
res := tos_clone( buf )
return res
return tos3(buf)
//res := tos_clone(buf)
//return res
}
}