mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 05:23:40 +00:00
all: use unsafe.SliceData where appropriate
This commit is contained in:
committed by
Ron Evans
parent
de83d67364
commit
70a0dee8c8
@@ -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
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user