all: use unsafe.SliceData where appropriate

This commit is contained in:
Ayke van Laethem
2026-05-11 10:04:00 +02:00
committed by Ron Evans
parent de83d67364
commit 70a0dee8c8
9 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ var (
putcharBuffer = [putcharBufferSize]byte{}
putcharPosition uint = 0
putcharIOVec = __wasi_iovec_t{
buf: unsafe.Pointer(&putcharBuffer[0]),
buf: unsafe.Pointer(unsafe.SliceData(putcharBuffer[:])),
}
putcharNWritten uint
)
+1 -1
View File
@@ -35,7 +35,7 @@ func os_runtime_args() []string {
// Obtain the command line arguments
argsSlice := make([]unsafe.Pointer, argc)
buf := make([]byte, argv_buf_size)
args_get(&argsSlice[0], unsafe.Pointer(&buf[0]))
args_get(&argsSlice[0], unsafe.Pointer(unsafe.SliceData(buf)))
// Convert the array of C strings to an array of Go strings.
args = make([]string, argc)
+1 -1
View File
@@ -280,7 +280,7 @@ func cgo_GoBytes(ptr unsafe.Pointer, length uintptr) []byte {
// of upstream Go.
buf := make([]byte, length)
if length != 0 {
memcpy(unsafe.Pointer(&buf[0]), ptr, uintptr(length))
memcpy(unsafe.Pointer(unsafe.SliceData(buf)), ptr, uintptr(length))
}
return buf
}