1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: tag array methods unsafe: *_many, grow_len, pointers (#8983)

This commit is contained in:
Nick Treleaven
2021-02-26 21:55:09 +00:00
committed by GitHub
parent 8874379c48
commit 23f231ee61
6 changed files with 14 additions and 10 deletions

View File

@ -27,7 +27,7 @@ pub fn new_builder(initial_size int) Builder {
// write_bytes appends `bytes` to the accumulated buffer
[unsafe]
pub fn (mut b Builder) write_bytes(bytes byteptr, howmany int) {
b.buf.push_many(bytes, howmany)
unsafe { b.buf.push_many(bytes, howmany) }
b.len += howmany
}
@ -50,7 +50,7 @@ pub fn (mut b Builder) write_string(s string) {
if s == '' {
return
}
b.buf.push_many(s.str, s.len)
unsafe { b.buf.push_many(s.str, s.len) }
// for c in s {
// b.buf << c
// }
@ -99,7 +99,7 @@ pub fn (mut b Builder) writeln(s string) {
// for c in s {
// b.buf << c
// }
b.buf.push_many(s.str, s.len)
unsafe { b.buf.push_many(s.str, s.len) }
// b.buf << []byte(s) // TODO
b.buf << `\n`
b.len += s.len + 1