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

map: fix a bug with an incorrect size after delete()

This commit is contained in:
Alexander Medvednikov 2019-12-19 21:11:42 +03:00
parent 519f2990f2
commit 26f5d34e64

View File

@ -55,6 +55,9 @@ fn new_node(key string, val voidptr, element_size int) &mapnode {
fn (m mut map) insert(n mut mapnode, key string, val voidptr) {
if n.key == key {
C.memcpy(n.val, val, m.element_size)
if n.is_empty {
m.size++
}
return
}
if n.key > key {