From 29330c118d33c8d7c8b1e7f1caf51b421bd4ee04 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 21 Oct 2015 17:19:49 -0700 Subject: [PATCH] runtime: change fixalloc's chunk field to unsafe.Pointer It's never used as a *byte anyway, so might as well just make it an unsafe.Pointer instead. Change-Id: I68ee418781ab2fc574eeac0498f2515b5561b7a8 Reviewed-on: https://go-review.googlesource.com/16175 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/runtime/mfixalloc.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/mfixalloc.go b/src/runtime/mfixalloc.go index 57a136d06b..54d4a74453 100644 --- a/src/runtime/mfixalloc.go +++ b/src/runtime/mfixalloc.go @@ -23,7 +23,7 @@ type fixalloc struct { first func(arg, p unsafe.Pointer) // called first time p is returned arg unsafe.Pointer list *mlink - chunk *byte + chunk unsafe.Pointer nchunk uint32 inuse uintptr // in-use bytes now stat *uint64 @@ -64,15 +64,15 @@ func fixAlloc_Alloc(f *fixalloc) unsafe.Pointer { return v } if uintptr(f.nchunk) < f.size { - f.chunk = (*uint8)(persistentalloc(_FixAllocChunk, 0, f.stat)) + f.chunk = persistentalloc(_FixAllocChunk, 0, f.stat) f.nchunk = _FixAllocChunk } - v := unsafe.Pointer(f.chunk) + v := f.chunk if f.first != nil { f.first(f.arg, v) } - f.chunk = (*byte)(add(unsafe.Pointer(f.chunk), f.size)) + f.chunk = add(f.chunk, f.size) f.nchunk -= uint32(f.size) f.inuse += f.size return v -- 2.50.0