From bf9f1c15035ab9bb695a9a3504e465a1896b4b8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20M=C3=B6hrmann?= Date: Sat, 3 Feb 2018 16:29:54 +0100 Subject: [PATCH] runtime: use new instead of newobject to create hmap in makemap MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/runtime/hashmap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go index dee5dd5816..eddb045622 100644 --- a/src/runtime/hashmap.go +++ b/src/runtime/hashmap.go @@ -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() -- 2.50.0