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>
This commit is contained in:
Keith Randall 2024-10-28 14:15:13 -07:00
parent 4dcbb00be2
commit 4b30a40d88
2 changed files with 4 additions and 4 deletions

View file

@ -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
}