diff options
| author | cuiweixie <cuiweixie@gmail.com> | 2022-09-03 14:29:35 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-09-07 01:48:30 +0000 |
| commit | 4fe4601d37179facbf7e79627ef9d6a236364505 (patch) | |
| tree | d857d550d18c9a4f4f35af582c4aa84afdecbde5 /src/runtime/proc.go | |
| parent | 2ee075dc47ec686b48746fd261212b044705fcdc (diff) | |
| download | go-4fe4601d37179facbf7e79627ef9d6a236364505.tar.xz | |
runtime: simplify code using unsafe.{Slice,String}
Updates #54854
Change-Id: Ie18665e93e477b6f220acf4c6c070b2af4343064
Reviewed-on: https://go-review.googlesource.com/c/go/+/428157
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime/proc.go')
| -rw-r--r-- | src/runtime/proc.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 9ebb25bfd0..1e4d4098b6 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -620,7 +620,7 @@ func cpuinit() { for i := int32(0); i < n; i++ { p := argv_index(argv, argc+1+i) - s := *(*string)(unsafe.Pointer(&stringStruct{unsafe.Pointer(p), findnull(p)})) + s := unsafe.String(p, findnull(p)) if hasPrefix(s, prefix) { env = gostring(p)[len(prefix):] |
