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

map: fix map_test.v error

This commit is contained in:
yuyi 2020-04-09 09:57:08 +08:00 committed by GitHub
parent 8f8f8c418e
commit bf20b01586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -363,10 +363,10 @@ pub fn (m mut map) delete(key string) {
m.size--
m.metas[index] = 0
m.key_values.deletes++
C.memset(&m.key_values.data[kv_index], 0, sizeof(KeyValue))
if m.key_values.size <= 32 {
return
}
C.memset(&m.key_values.data[kv_index], 0, sizeof(KeyValue))
// Clean up key_values if too many have been deleted
if m.key_values.deletes >= (m.key_values.size >> 1) {
m.key_values.zeros_to_end()