]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: replace unsafe pointer arithmetic with array indexing
authorMatthew Dempsky <mdempsky@google.com>
Wed, 21 Oct 2015 19:30:58 +0000 (12:30 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 21 Oct 2015 23:22:20 +0000 (23:22 +0000)
Change-Id: I313819abebd4cda4a6c30fd0fd6f44cb1d09161f
Reviewed-on: https://go-review.googlesource.com/16167
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/mfinal.go

index 24f35d2163b99774180b9bb1823657bff2108024..d6a8da9619cae385c8ca46f12a2feb79f9c58ee7 100644 (file)
@@ -160,7 +160,7 @@ func runfinq() {
                }
                for fb != nil {
                        for i := fb.cnt; i > 0; i-- {
-                               f := (*finalizer)(add(unsafe.Pointer(&fb.fin), uintptr(i-1)*unsafe.Sizeof(finalizer{})))
+                               f := &fb.fin[i-1]
 
                                framesz := unsafe.Sizeof((interface{})(nil)) + uintptr(f.nret)
                                if framecap < framesz {