mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: fix -d debug_realloc
, add realloc_data/3
This commit is contained in:
@ -445,6 +445,7 @@ pub fn get_raw_stdin() []byte {
|
||||
$if windows {
|
||||
unsafe {
|
||||
block_bytes := 512
|
||||
mut old_size := block_bytes
|
||||
mut buf := malloc(block_bytes)
|
||||
h_input := C.GetStdHandle(C.STD_INPUT_HANDLE)
|
||||
mut bytes_read := 0
|
||||
@ -456,7 +457,9 @@ pub fn get_raw_stdin() []byte {
|
||||
if !res {
|
||||
break
|
||||
}
|
||||
buf = v_realloc(buf, offset + block_bytes + (block_bytes - bytes_read))
|
||||
new_size := offset + block_bytes + (block_bytes - bytes_read)
|
||||
buf = realloc_data(buf, old_size, new_size)
|
||||
old_size = new_size
|
||||
}
|
||||
return array{
|
||||
element_size: 1
|
||||
|
Reference in New Issue
Block a user