mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
remove bytes.Copy
replace all calls with calls to copy use copy in regexp and bytes.Buffer R=rsc CC=golang-dev https://golang.org/cl/157073
This commit is contained in:
parent
093493c6a5
commit
e70cedfaec
22 changed files with 147 additions and 218 deletions
|
|
@ -20,10 +20,11 @@ func copyString(dst []byte, doff int, str string) {
|
|||
|
||||
// Copy from bytes to byte array at offset doff. Assume there's room.
|
||||
func copyBytes(dst []byte, doff int, src []byte) {
|
||||
for soff := 0; soff < len(src); soff++ {
|
||||
dst[doff] = src[soff];
|
||||
doff++;
|
||||
if len(src) == 1 {
|
||||
dst[doff] = src[0];
|
||||
return;
|
||||
}
|
||||
copy(dst[doff:len(dst)], src);
|
||||
}
|
||||
|
||||
// A Buffer is a variable-sized buffer of bytes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue