Sfoglia il codice sorgente

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/.
Jakob Borg 9 anni fa
parent
commit
d0a1c805e9
1 ha cambiato i file con 1 aggiunte e 2 eliminazioni
  1. 1 2
      cmd/syncthing/memsize_windows.go

+ 1 - 2
cmd/syncthing/memsize_windows.go

@@ -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
 	}
 	}