mirror of
https://github.com/golang/go
synced 2024-11-19 16:14:49 -07:00
runtime: only clear key string's pointer in mapdelete_faststr
Change-Id: I0360d294868ec4423e4ae036009fac4e72425c9c Reviewed-on: https://go-review.googlesource.com/59152 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
8adaf68570
commit
dc10aeeff8
@ -754,7 +754,8 @@ search:
|
|||||||
if k.str != key.str && !memequal(k.str, key.str, uintptr(key.len)) {
|
if k.str != key.str && !memequal(k.str, key.str, uintptr(key.len)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
*(*string)(kptr) = ""
|
// Clear key's pointer.
|
||||||
|
k.str = nil
|
||||||
// Only clear value if there are pointers in it.
|
// Only clear value if there are pointers in it.
|
||||||
if t.elem.kind&kindNoPointers == 0 {
|
if t.elem.kind&kindNoPointers == 0 {
|
||||||
v := add(unsafe.Pointer(b), dataOffset+bucketCnt*2*sys.PtrSize+i*uintptr(t.valuesize))
|
v := add(unsafe.Pointer(b), dataOffset+bucketCnt*2*sys.PtrSize+i*uintptr(t.valuesize))
|
||||||
|
Loading…
Reference in New Issue
Block a user