mirror of
https://github.com/golang/go
synced 2024-11-19 15:14:45 -07:00
runtime: use new instead of newobject to create hmap in makemap
The runtime.hmap type is known at compile time. Using new(hmap) avoids loading the hmap type from the maptype supplied as an argument to makemap which is only known at runtime. This change makes makemap consistent with makemap_small by using new(hmap) instead of newobject in both functions. Change-Id: Ia47acfda527e8a71d15a1a7a4c2b54fb923515eb Reviewed-on: https://go-review.googlesource.com/91775 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
530927e08a
commit
bf9f1c1503
@ -309,7 +309,7 @@ func makemap(t *maptype, hint int, h *hmap) *hmap {
|
||||
|
||||
// initialize Hmap
|
||||
if h == nil {
|
||||
h = (*hmap)(newobject(t.hmap))
|
||||
h = new(hmap)
|
||||
}
|
||||
h.hash0 = fastrand()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user