]> Cypherpunks repositories - gostls13.git/commitdiff
internal/syscall/windows: use unsafe.Slice instead of unsafeheader package
authorTobias Klauser <tklauser@distanz.ch>
Wed, 7 Sep 2022 15:23:03 +0000 (17:23 +0200)
committerGopher Robot <gobot@golang.org>
Fri, 9 Sep 2022 13:00:05 +0000 (13:00 +0000)
Follow CL 428777.

Change-Id: I5ce49322e92c5d6539bb08248e3366187c30dcd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/428780
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>

src/internal/syscall/windows/syscall_windows.go

index de7cda209411b86562f0a6311577eeda3e41f8a0..39ff25fcb7bb1580b42a6891c1485f39f0329bd7 100644 (file)
@@ -5,7 +5,6 @@
 package windows
 
 import (
-       "internal/unsafeheader"
        "sync"
        "syscall"
        "unicode/utf16"
@@ -26,11 +25,7 @@ func UTF16PtrToString(p *uint16) string {
                n++
        }
        // Turn *uint16 into []uint16.
-       var s []uint16
-       hdr := (*unsafeheader.Slice)(unsafe.Pointer(&s))
-       hdr.Data = unsafe.Pointer(p)
-       hdr.Cap = n
-       hdr.Len = n
+       s := unsafe.Slice((*uint16)(unsafe.Pointer(p)), n)
        // Decode []uint16 into string.
        return string(utf16.Decode(s))
 }