mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: use malloc_noscan()
where possible (#10465)
This commit is contained in:
@@ -5,7 +5,7 @@ pub fn repeat(c byte, n int) string {
|
||||
if n <= 0 {
|
||||
return ''
|
||||
}
|
||||
mut bytes := unsafe { malloc(n + 1) }
|
||||
mut bytes := unsafe { malloc_noscan(n + 1) }
|
||||
unsafe {
|
||||
C.memset(bytes, c, n)
|
||||
bytes[n] = `0`
|
||||
@@ -22,7 +22,7 @@ pub fn repeat_string(s string, n int) string {
|
||||
}
|
||||
slen := s.len
|
||||
blen := slen * n
|
||||
mut bytes := unsafe { malloc(blen + 1) }
|
||||
mut bytes := unsafe { malloc_noscan(blen + 1) }
|
||||
for bi in 0 .. n {
|
||||
bislen := bi * slen
|
||||
for si in 0 .. slen {
|
||||
|
Reference in New Issue
Block a user