builtin/array: make push_many private

pull/13848/head
Nick Treleaven 2022-03-28 11:50:40 +01:00
parent 875ad1f6ea
commit 2021c869cf
2 changed files with 3 additions and 2 deletions

View File

@ -594,7 +594,7 @@ fn (mut a array) push(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]
pub fn (mut a3 array) push_many(val voidptr, size int) {
fn (mut a3 array) push_many(val voidptr, size int) {
a3.ensure_cap(a3.len + size)
if a3.data == val && !isnil(a3.data) {
// handle `arr << arr`

View File

@ -28,7 +28,8 @@ pub fn (mut ctx Context) write(s string) {
if s == '' {
return
}
unsafe { ctx.print_buf.push_many(s.str, s.len) }
tmp := unsafe { s.str.vbytes(s.len) }
ctx.print_buf << tmp
}
// flush displays the accumulated print buffer to the screen.