aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2024-10-28 14:15:13 -0700
committerKeith Randall <khr@golang.org>2024-10-29 16:47:05 +0000
commit4b30a40d8856cc3f6c8f629a9f825feeaf9848af (patch)
tree696fe852c91504a49caa1705b7f5db53d751cd9c /src/runtime/string.go
parent4dcbb00be200bc1f88b534c311ed4289eb2fbdd5 (diff)
downloadgo-4b30a40d8856cc3f6c8f629a9f825feeaf9848af.tar.xz
strings,bytes: use result of copy in subsequent slicing
This can get rid of a bounds check. Followup to CL 622240. Change-Id: I9d0a2c0408b8d274c46136d32d7a5fb09b4aad1c Reviewed-on: https://go-review.googlesource.com/c/go/+/622955 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 640ee02a3c..e43f4cca51 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -51,8 +51,8 @@ func concatstrings(buf *tmpBuf, a []string) string {
}
s, b := rawstringtmp(buf, l)
for _, x := range a {
- copy(b, x)
- b = b[len(x):]
+ n := copy(b, x)
+ b = b[n:]
}
return s
}