Skip to content

Commit be51143

Browse files
committed
strings: fix using array_push_many inside write_string + gc, not using array_push_many_noscan (part 1)
1 parent eec9c7f commit be51143

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

vlib/builtin/array_d_gcboehm_opt.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn (mut a array) push_noscan(val voidptr) {
255255
// push_many implements the functionality for pushing another array.
256256
// `val` is array.data and user facing usage is `a << [1,2,3]`
257257
@[unsafe]
258-
fn (mut a3 array) push_many_noscan(val voidptr, size int) {
258+
pub fn (mut a3 array) push_many_noscan(val voidptr, size int) {
259259
if size <= 0 || val == unsafe { nil } {
260260
return
261261
}

vlib/strings/builder.c.v

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ pub fn (mut b Builder) write_string(s string) {
134134
if s.len == 0 {
135135
return
136136
}
137-
unsafe { b.push_many(s.str, s.len) }
137+
$if gcboehm ? {
138+
unsafe { b.push_many_noscan(s.str, s.len) }
139+
} $else {
140+
unsafe { b.push_many(s.str, s.len) }
141+
}
138142
// for c in s {
139143
// b.buf << c
140144
// }

0 commit comments

Comments
 (0)