plan9: use bytes.IndexByte instead of a for loop

Change-Id: Iae896dc32e775cb469fc3d0d367fd7c7825161ec
Reviewed-on: https://go-review.googlesource.com/99516
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Tobias Klauser
2018-03-08 13:25:47 +01:00
committed by Tobias Klauser
parent e64a828a1b
commit 7dca6fe1f4

View File

@@ -12,6 +12,7 @@
package plan9
import (
"bytes"
"syscall"
"unsafe"
)
@@ -50,12 +51,11 @@ func atoi(b []byte) (n uint) {
}
func cstring(s []byte) string {
for i := range s {
if s[i] == 0 {
return string(s[0:i])
}
i := bytes.IndexByte(s, 0)
if i == -1 {
i = len(s)
}
return string(s)
return string(s[:i])
}
func errstr() string {