mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
unix: use unsafe.Slice in (*FileHandle).Bytes
Change-Id: Ic2b88577ec6fd975bbba0538790d2ff312d85d3f Reviewed-on: https://go-review.googlesource.com/c/sys/+/435776 Reviewed-by: Benny Siegert <bsiegert@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
committed by
Gopher Robot
parent
6fa7a7ca2b
commit
f11e5e49a4
@@ -2252,7 +2252,7 @@ func (fh *FileHandle) Bytes() []byte {
|
||||
if n == 0 {
|
||||
return nil
|
||||
}
|
||||
return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n]
|
||||
return unsafe.Slice((*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type))+4)), n)
|
||||
}
|
||||
|
||||
// NameToHandleAt wraps the name_to_handle_at system call; it obtains
|
||||
|
||||
Reference in New Issue
Block a user