Skip to content

Commit

Permalink
Comment unused code in system/internal/main.go (fixes remaining 'go t…
Browse files Browse the repository at this point in the history
…est' errors).
  • Loading branch information
lthibault committed Jul 24, 2023
1 parent 8afa31c commit 9c5c49c
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions system/internal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ package main

import (
"fmt"
"unsafe"
)

var hostbuf, guestbuf []byte
// var hostbuf, guestbuf []byte

// main is just a demo right now. It is the counterpart to
// the net.Conn that is the subject of ww.go's demo. It reads
Expand All @@ -31,16 +30,16 @@ func main() {
// // -- DEMO
}

//go:export __init
func wwinit(host, guest uint32) {
hostbuf = make([]byte, int(host))
guestbuf = make([]byte, int(guest))
initBuffers(bytesToPointer(hostbuf), bytesToPointer(guestbuf))
}
// //go:export __init
// func wwinit(host, guest uint32) {
// hostbuf = make([]byte, int(host))
// guestbuf = make([]byte, int(guest))
// initBuffers(bytesToPointer(hostbuf), bytesToPointer(guestbuf))
// }

//go:wasm-module ww
//go:export __init_buffers
func initBuffers(guestBufPtr, hostBufPtr uintptr)
// //go:wasm-module ww
// //go:export __init_buffers
// func initBuffers(guestBufPtr, hostBufPtr uintptr)

// //go:wasm-module ww
// //go:export _recv
Expand Down Expand Up @@ -85,14 +84,14 @@ func initBuffers(guestBufPtr, hostBufPtr uintptr)
// return
// }

//go:inline
func bytesToPointer(b []byte) uintptr {
pointer := unsafe.SliceData(b)
return uintptr(unsafe.Pointer(pointer))
}
// //go:inline
// func bytesToPointer(b []byte) uintptr {
// pointer := unsafe.SliceData(b)
// return uintptr(unsafe.Pointer(pointer))
// }

//go:inline
func stringToPointer(s string) uintptr {
pointer := unsafe.StringData(s)
return uintptr(unsafe.Pointer(pointer))
}
// //go:inline
// func stringToPointer(s string) uintptr {
// pointer := unsafe.StringData(s)
// return uintptr(unsafe.Pointer(pointer))
// }

0 comments on commit 9c5c49c

Please sign in to comment.