map: fix a bug with an incorrect size after delete()
parent
519f2990f2
commit
26f5d34e64
|
@ -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) {
|
fn (m mut map) insert(n mut mapnode, key string, val voidptr) {
|
||||||
if n.key == key {
|
if n.key == key {
|
||||||
C.memcpy(n.val, val, m.element_size)
|
C.memcpy(n.val, val, m.element_size)
|
||||||
|
if n.is_empty {
|
||||||
|
m.size++
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if n.key > key {
|
if n.key > key {
|
||||||
|
|
Loading…
Reference in New Issue