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

all: remove byteptr and charptr; replace them with &byte and &char

This commit is contained in:
Alexander Medvednikov
2021-04-04 17:43:32 +03:00
parent 8dd4a63913
commit 57e6138a61
32 changed files with 250 additions and 226 deletions

View File

@@ -28,13 +28,13 @@ pub fn new_builder(initial_size int) Builder {
[deprecated: 'use Builder.write_ptr() instead']
[deprecated_after: '2021-04-18']
[unsafe]
pub fn (mut b Builder) write_bytes(bytes byteptr, len int) {
pub fn (mut b Builder) write_bytes(bytes &byte, 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) {
pub fn (mut b Builder) write_ptr(ptr &byte, len int) {
unsafe { b.buf.push_many(ptr, len) }
b.len += len
}
@@ -140,7 +140,7 @@ pub fn (b &Builder) after(n int) string {
// .str() call.
pub fn (mut b Builder) str() string {
b.buf << `\0`
s := unsafe { byteptr(memdup(b.buf.data, b.len)).vstring_with_len(b.len) }
s := unsafe { (&byte(memdup(b.buf.data, b.len))).vstring_with_len(b.len) }
b.len = 0
b.buf.trim(0)
return s