Skip to content

Commit 64e598f

Browse files
committed
runtime: use efaceOf where applicable
Prepared with gofmt -r. Change-Id: Ifea325c209d800b5692d318955930b10debb548b Reviewed-on: https://go-review.googlesource.com/c/go/+/198494 Run-TryBot: Matthew Dempsky <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent debbb1e commit 64e598f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/runtime/cgocall.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func cgoCheckPointer(ptr interface{}, arg interface{}) {
411411
return
412412
}
413413

414-
ep := (*eface)(unsafe.Pointer(&ptr))
414+
ep := efaceOf(&ptr)
415415
t := ep._type
416416

417417
top := true
@@ -423,7 +423,7 @@ func cgoCheckPointer(ptr interface{}, arg interface{}) {
423423
if p == nil || !cgoIsGoPointer(p) {
424424
return
425425
}
426-
aep := (*eface)(unsafe.Pointer(&arg))
426+
aep := efaceOf(&arg)
427427
switch aep._type.kind & kindMask {
428428
case kindBool:
429429
if t.kind&kindMask == kindUnsafePointer {
@@ -650,7 +650,7 @@ func cgoCheckResult(val interface{}) {
650650
return
651651
}
652652

653-
ep := (*eface)(unsafe.Pointer(&val))
653+
ep := efaceOf(&val)
654654
t := ep._type
655655
cgoCheckArg(t, ep.data, t.kind&kindDirectIface == 0, false, cgoResultFail)
656656
}

src/runtime/iface.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ var (
295295
stringEface interface{} = stringInterfacePtr("")
296296
sliceEface interface{} = sliceInterfacePtr(nil)
297297

298-
uint16Type *_type = (*eface)(unsafe.Pointer(&uint16Eface))._type
299-
uint32Type *_type = (*eface)(unsafe.Pointer(&uint32Eface))._type
300-
uint64Type *_type = (*eface)(unsafe.Pointer(&uint64Eface))._type
301-
stringType *_type = (*eface)(unsafe.Pointer(&stringEface))._type
302-
sliceType *_type = (*eface)(unsafe.Pointer(&sliceEface))._type
298+
uint16Type *_type = efaceOf(&uint16Eface)._type
299+
uint32Type *_type = efaceOf(&uint32Eface)._type
300+
uint64Type *_type = efaceOf(&uint64Eface)._type
301+
stringType *_type = efaceOf(&stringEface)._type
302+
sliceType *_type = efaceOf(&sliceEface)._type
303303
)
304304

305305
// The conv and assert functions below do very similar things.

0 commit comments

Comments
 (0)