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:
@ -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
|
||||
|
Reference in New Issue
Block a user