diff options
| author | Keith Randall <khr@golang.org> | 2014-06-17 21:59:50 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2014-06-17 21:59:50 -0700 |
| commit | 14c8143c31fc38fc661188247aa6d3b9d25ae394 (patch) | |
| tree | 41a71be20e214425b10fe90468a61d9ea9809979 /src/pkg/runtime/string.go | |
| parent | b559392e1b84f521a8b9c2d3c1164960c62799c8 (diff) | |
| download | go-14c8143c31fc38fc661188247aa6d3b9d25ae394.tar.xz | |
runtime: fix gogetcallerpc.
Make assembly govet-clean.
Clean up fixes for CL 93380044.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/107160047
Diffstat (limited to 'src/pkg/runtime/string.go')
| -rw-r--r-- | src/pkg/runtime/string.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pkg/runtime/string.go b/src/pkg/runtime/string.go index 9805dd5128..69516af066 100644 --- a/src/pkg/runtime/string.go +++ b/src/pkg/runtime/string.go @@ -143,15 +143,19 @@ func slicerunetostring(a []rune) string { return s[:size2] } +type stringStruct struct { + str *byte + len int +} + func cstringToGo(str uintptr) (s string) { - // Note: we need i to be the same type as _string.len and to start at 0. - i := _string{}.len + i := 0 for ; ; i++ { if *(*byte)(unsafe.Pointer(str + uintptr(i))) == 0 { break } } - t := (*_string)(unsafe.Pointer(&s)) + t := (*stringStruct)(unsafe.Pointer(&s)) t.str = (*byte)(unsafe.Pointer(str)) t.len = i return |
