aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 5c83895995..0ea162235c 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -407,12 +407,9 @@ func findnull(s *byte) int {
if s == nil {
return 0
}
- p := (*[maxAlloc/2 - 1]byte)(unsafe.Pointer(s))
- l := 0
- for p[l] != 0 {
- l++
- }
- return l
+ ss := stringStruct{unsafe.Pointer(s), maxAlloc/2 - 1}
+ t := *(*string)(unsafe.Pointer(&ss))
+ return stringsIndexByte(t, 0)
}
func findnullw(s *uint16) int {