From a3327b9b073f1a3c03f91f2ec825b5eeae38b125 Mon Sep 17 00:00:00 2001 From: vedhavyas Date: Sat, 4 Jan 2020 13:17:26 +0100 Subject: [PATCH] remove unsafe pointer --- bridge.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridge.go b/bridge.go index 9fc55c5..ed549c7 100644 --- a/bridge.go +++ b/bridge.go @@ -28,7 +28,7 @@ var ( type bctx struct{ n string } -func getCtxData(b *Bridge) (unsafe.Pointer, error) { +func getCtxData(b *Bridge) (*bctx, error) { mu.Lock() defer mu.Unlock() if _, ok := bridges[b.name]; ok { @@ -36,12 +36,12 @@ func getCtxData(b *Bridge) (unsafe.Pointer, error) { } bridges[b.name] = b - return unsafe.Pointer(&bctx{n: b.name}), nil + return &bctx{n: b.name}, nil } func getBridge(ctx unsafe.Pointer) *Bridge { ictx := wasmer.IntoInstanceContext(ctx) - c := (*bctx)((ictx.Data()).(unsafe.Pointer)) + c := (ictx.Data()).(*bctx) mu.RLock() defer mu.RUnlock() return bridges[c.n]