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
+2 -2
View File
@@ -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()
}
+1 -1
View File
@@ -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
}