diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2024-02-20 17:10:16 +0100 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-02-26 20:46:01 +0000 |
commit | 4760b33326392c459bb5825938d57ce55d40224a (patch) | |
tree | 6c77bc3a649e1883ac31999d025a477091c41d2c /src/time | |
parent | 08029be9fc12023f036bc695efd688fc4616f0c7 (diff) | |
download | go-4760b33326392c459bb5825938d57ce55d40224a.tar.gz go-4760b33326392c459bb5825938d57ce55d40224a.zip |
time: use bytealg.IndexByte in byteString
Change-Id: I0d42bca7c6ee63c05a0ca09c165f2f591edf7c34
Reviewed-on: https://go-review.googlesource.com/c/go/+/565356
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Diffstat (limited to 'src/time')
-rw-r--r-- | src/time/zoneinfo_read.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/time/zoneinfo_read.go b/src/time/zoneinfo_read.go index 707dd1189d..9ce735d279 100644 --- a/src/time/zoneinfo_read.go +++ b/src/time/zoneinfo_read.go @@ -11,6 +11,7 @@ package time import ( "errors" + "internal/bytealg" "runtime" "syscall" ) @@ -99,10 +100,8 @@ func (d *dataIO) rest() []byte { // Make a string by stopping at the first NUL func byteString(p []byte) string { - for i := 0; i < len(p); i++ { - if p[i] == 0 { - return string(p[0:i]) - } + if i := bytealg.IndexByte(p, 0); i != -1 { + p = p[:i] } return string(p) } |