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

all: use v_realloc

This commit is contained in:
Alexander Medvednikov
2020-07-11 12:37:51 +02:00
parent 867929e0b4
commit 649821be4c
4 changed files with 11 additions and 11 deletions

View File

@@ -280,7 +280,7 @@ pub fn (mut ws Client) write(payload byteptr, payload_len int, code OPCode) int
goto free_data
return -1
}
unsafe
unsafe
{
C.memcpy(fbdata, header.data, header_len)
C.memcpy(fbdata + header_len, payload, payload_len)
@@ -385,7 +385,7 @@ pub fn (mut ws Client) read() int {
frame_size = u64(header_len) + payload_len
if frame_size > initial_buffer {
l.d('reallocating: ${frame_size}')
data = C.realloc(data, frame_size)
data = v_realloc(data, frame_size)
}
} else if frame.payload_len == u64(127) && bytes_read == u64(extended_payload64_end_byte) {
header_len += 8 // TODO Not sure...
@@ -409,7 +409,7 @@ pub fn (mut ws Client) read() int {
frame_size = u64(header_len) + payload_len
if frame_size > initial_buffer {
l.d('reallocating: ${frame_size}')
data = C.realloc(data, frame_size)
data = v_realloc(data, frame_size)
}
}
}