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

all: voidptr(0) => unsafe { nil } (p.2)

This commit is contained in:
Alexander Medvednikov
2022-07-21 20:51:54 +03:00
parent 1f25811786
commit dc79f1392b
8 changed files with 32 additions and 32 deletions

View File

@ -139,7 +139,7 @@ fn (mut a array) ensure_cap(required int) {
}
new_size := u64(cap) * u64(a.element_size)
new_data := unsafe { malloc(new_size) }
if a.data != voidptr(0) {
if a.data != unsafe { nil } {
unsafe { vmemcpy(new_data, a.data, u64(a.len) * u64(a.element_size)) }
// TODO: the old data may be leaked when no GC is used (ref-counting?)
if a.flags.has(.noslices) {