We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1f7213 commit 370ba44Copy full SHA for 370ba44
vlib/os/os.c.v
@@ -504,7 +504,8 @@ pub fn get_raw_line() string {
504
$if windows {
505
unsafe {
506
max_line_chars := 256
507
- buf := malloc_noscan(max_line_chars * 2)
+ mut old_size := max_line_chars * 2
508
+ mut buf := malloc_noscan(old_size)
509
h_input := C.GetStdHandle(C.STD_INPUT_HANDLE)
510
mut bytes_read := u32(0)
511
if is_atty(0) > 0 {
@@ -530,6 +531,11 @@ pub fn get_raw_line() string {
530
531
break
532
}
533
offset++
534
+ if offset >= old_size {
535
+ new_size := old_size + max_line_chars * 2
536
+ buf = realloc_data(buf, old_size, new_size)
537
+ old_size = new_size
538
+ }
539
540
return buf.vstring_with_len(offset)
541
0 commit comments