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

os: deprecate os.File.write_bytes and add os.File.write_ptr (#9370)

This commit is contained in:
zakuro
2021-03-20 16:02:28 +09:00
committed by GitHub
parent ead0dff55a
commit e3c0f305b2
10 changed files with 41 additions and 15 deletions

View File

@ -25,10 +25,17 @@ pub fn new_builder(initial_size int) Builder {
}
// write_bytes appends `bytes` to the accumulated buffer
[deprecated: 'use Builder.write_ptr() instead']
[unsafe]
pub fn (mut b Builder) write_bytes(bytes byteptr, howmany int) {
unsafe { b.buf.push_many(bytes, howmany) }
b.len += howmany
pub fn (mut b Builder) write_bytes(bytes byteptr, len int) {
unsafe { b.write_ptr(bytes, len) }
}
// write_ptr writes `len` bytes provided byteptr to the accumulated buffer
[unsafe]
pub fn (mut b Builder) write_ptr(ptr byteptr, len int) {
unsafe { b.buf.push_many(ptr, len) }
b.len += len
}
// write_b appends a single `data` byte to the accumulated buffer