mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
vlib: use malloc_noscan()
where possible (#10465)
This commit is contained in:
parent
af60eba5e6
commit
60c880a0cc
28 changed files with 56 additions and 83 deletions
|
@ -35,7 +35,7 @@ pub fn decode_str(data string) string {
|
|||
return ''
|
||||
}
|
||||
unsafe {
|
||||
buffer := malloc(size + 1)
|
||||
buffer := malloc_noscan(size + 1)
|
||||
buffer[size] = 0
|
||||
return tos(buffer, decode_in_buffer(data, buffer))
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ fn alloc_and_encode(src &byte, len int) string {
|
|||
return ''
|
||||
}
|
||||
unsafe {
|
||||
buffer := malloc(size + 1)
|
||||
buffer := malloc_noscan(size + 1)
|
||||
buffer[size] = 0
|
||||
return tos(buffer, encode_from_buffer(buffer, src, len))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue