Skip to content

Commit

Permalink
strings: fix using array_push_many inside write_string + gc, not usin…
Browse files Browse the repository at this point in the history
…g array_push_many_noscan (part 1)
  • Loading branch information
spytheman committed Dec 1, 2023
1 parent eec9c7f commit be51143
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vlib/builtin/array_d_gcboehm_opt.v
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn (mut a array) push_noscan(val voidptr) {
// push_many implements the functionality for pushing another array.
// `val` is array.data and user facing usage is `a << [1,2,3]`
@[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 } {
return
}
Expand Down
6 changes: 5 additions & 1 deletion vlib/strings/builder.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ pub fn (mut b Builder) write_string(s string) {
if s.len == 0 {
return
}
unsafe { b.push_many(s.str, s.len) }
$if gcboehm ? {
unsafe { b.push_many_noscan(s.str, s.len) }
} $else {
unsafe { b.push_many(s.str, s.len) }
}
// for c in s {
// b.buf << c
// }
Expand Down

0 comments on commit be51143

Please sign in to comment.