From ae0c286edcc0a0732eb287b4ffd44153e7b6162e Mon Sep 17 00:00:00 2001 From: snyh Date: Wed, 12 Oct 2016 09:49:30 +0800 Subject: [PATCH] Convert uintptr to Pointer in one line It's invalid using of converting uintptr to unsafe.Pointer except do this in one line. See also: https://golang.org/pkg/unsafe/ (3) Change-Id: I15a3b056dda660a2f00bce7a7d80bf16f2e917a5 --- src/gir-generator/templates.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gir-generator/templates.go b/src/gir-generator/templates.go index add9fda..a934222 100644 --- a/src/gir-generator/templates.go +++ b/src/gir-generator/templates.go @@ -149,8 +149,8 @@ func To[<.name>](objlike [<.gobjectns>]ObjectLike) *[<.name>] { } func (this0 *[<.name>]Impl) Implements[<.cprefix>][<.name>]() [<.cgotype>] { - obj := uintptr(unsafe.Pointer(this0)) - unsafe.Sizeof(uintptr(0)) - return ([<.cgotype>])((*[<.gobjectns>]Object)(unsafe.Pointer(obj)).C) + base := unsafe.Pointer(uintptr(unsafe.Pointer(this0)) - unsafe.Sizeof(uintptr(0))) + return ([<.cgotype>])((*[<.gobjectns>]Object)(base).C) } `)