mirror of
https://github.com/golang/go
synced 2024-11-27 03:11:19 -07:00
runtime: initialize complete Hiter during mapiterinit
The garbage collector will scan these pointers, so make sure they are initialized. LGTM=bradfitz, khr R=khr, bradfitz CC=golang-codereviews https://golang.org/cl/80960047
This commit is contained in:
parent
a4380927eb
commit
fc6befba3c
@ -1004,6 +1004,14 @@ func reflect·mapdelete(t *MapType, h *Hmap, key *byte) {
|
|||||||
|
|
||||||
#pragma textflag NOSPLIT
|
#pragma textflag NOSPLIT
|
||||||
func mapiterinit(t *MapType, h *Hmap, it *Hiter) {
|
func mapiterinit(t *MapType, h *Hmap, it *Hiter) {
|
||||||
|
// Clear pointer fields so garbage collector does not complain.
|
||||||
|
it->key = nil;
|
||||||
|
it->value = nil;
|
||||||
|
it->t = nil;
|
||||||
|
it->h = nil;
|
||||||
|
it->buckets = nil;
|
||||||
|
it->bptr = nil;
|
||||||
|
|
||||||
if(h == nil || h->count == 0) {
|
if(h == nil || h->count == 0) {
|
||||||
it->key = nil;
|
it->key = nil;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user