Commit 7dca6fe1 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent e64a828a
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment