mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-08 23:08:27 +00:00
cmd/syncthing: uintptr may not be stored in a variable
Must do the whole uintptr(unsafe.Pointer(&whatever)) directly in the call to sycall.Call, as per https://golang.org/pkg/unsafe/.
This commit is contained in:
parent
00a654845f
commit
d0a1c805e9
@ -20,9 +20,8 @@ var (
|
|||||||
func memorySize() (int64, error) {
|
func memorySize() (int64, error) {
|
||||||
var memoryStatusEx [64]byte
|
var memoryStatusEx [64]byte
|
||||||
binary.LittleEndian.PutUint32(memoryStatusEx[:], 64)
|
binary.LittleEndian.PutUint32(memoryStatusEx[:], 64)
|
||||||
p := uintptr(unsafe.Pointer(&memoryStatusEx[0]))
|
|
||||||
|
|
||||||
ret, _, callErr := syscall.Syscall(uintptr(globalMemoryStatusEx), 1, p, 0, 0)
|
ret, _, callErr := syscall.Syscall(uintptr(globalMemoryStatusEx), 1, uintptr(unsafe.Pointer(&memoryStatusEx[0])), 0, 0)
|
||||||
if ret == 0 {
|
if ret == 0 {
|
||||||
return 0, callErr
|
return 0, callErr
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user