mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
all: use unsafe.SliceData where appropriate
This commit is contained in:
committed by
Ron Evans
parent
de83d67364
commit
70a0dee8c8
@@ -229,7 +229,7 @@ func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, e
|
||||
}
|
||||
|
||||
func Munmap(b []byte) (err error) {
|
||||
errCode := libc_munmap(unsafe.Pointer(&b[0]), uintptr(len(b)))
|
||||
errCode := libc_munmap(unsafe.Pointer(unsafe.SliceData(b)), uintptr(len(b)))
|
||||
if errCode != 0 {
|
||||
err = getErrno()
|
||||
}
|
||||
@@ -237,7 +237,7 @@ func Munmap(b []byte) (err error) {
|
||||
}
|
||||
|
||||
func Mprotect(b []byte, prot int) (err error) {
|
||||
errCode := libc_mprotect(unsafe.Pointer(&b[0]), uintptr(len(b)), int32(prot))
|
||||
errCode := libc_mprotect(unsafe.Pointer(unsafe.SliceData(b)), uintptr(len(b)), int32(prot))
|
||||
if errCode != 0 {
|
||||
err = getErrno()
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ type RawSockaddrInet6 struct {
|
||||
|
||||
func RandomGet(b []byte) error {
|
||||
if len(b) > 0 {
|
||||
libc_arc4random_buf(unsafe.Pointer(&b[0]), uint(len(b)))
|
||||
libc_arc4random_buf(unsafe.Pointer(unsafe.SliceData(b)), uint(len(b)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user