mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
strings: fix using array_push_many inside write_string + gc, not using array_push_many_noscan (part 1)
This commit is contained in:
parent
eec9c7f242
commit
be51143ac5
2 changed files with 6 additions and 2 deletions
|
@ -255,7 +255,7 @@ fn (mut a array) push_noscan(val voidptr) {
|
||||||
// push_many implements the functionality for pushing another array.
|
// push_many implements the functionality for pushing another array.
|
||||||
// `val` is array.data and user facing usage is `a << [1,2,3]`
|
// `val` is array.data and user facing usage is `a << [1,2,3]`
|
||||||
@[unsafe]
|
@[unsafe]
|
||||||
fn (mut a3 array) push_many_noscan(val voidptr, size int) {
|
pub fn (mut a3 array) push_many_noscan(val voidptr, size int) {
|
||||||
if size <= 0 || val == unsafe { nil } {
|
if size <= 0 || val == unsafe { nil } {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,11 @@ pub fn (mut b Builder) write_string(s string) {
|
||||||
if s.len == 0 {
|
if s.len == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
$if gcboehm ? {
|
||||||
|
unsafe { b.push_many_noscan(s.str, s.len) }
|
||||||
|
} $else {
|
||||||
unsafe { b.push_many(s.str, s.len) }
|
unsafe { b.push_many(s.str, s.len) }
|
||||||
|
}
|
||||||
// for c in s {
|
// for c in s {
|
||||||
// b.buf << c
|
// b.buf << c
|
||||||
// }
|
// }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue