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

array: replace make() with the new init syntax

This commit is contained in:
Alexander Medvednikov
2020-04-26 17:52:27 +02:00
parent f23948010a
commit 83552a0d58
6 changed files with 24 additions and 27 deletions

View File

@ -13,7 +13,8 @@ pub mut:
pub fn new_builder(initial_size int) Builder {
return Builder{
buf: make(0, initial_size, 1)
//buf: make(0, initial_size)
buf: []byte{cap: initial_size}
initial_size: initial_size
}
}
@ -86,7 +87,9 @@ pub fn (b mut Builder) free() {
unsafe{
free(b.buf.data)
}
b.buf = make(0, b.initial_size, 1)
// QTODO checker bug
s := b.initial_size
b.buf = []byte{cap: s}
b.len = 0
}