mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
bytes: removed unnecessary slicing on copy
Change-Id: Ia42e3479c852a88968947411de8b32e5bcda5ae3 Reviewed-on: https://go-review.googlesource.com/64371 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
57c79febda
commit
66ce8e383f
1 changed files with 1 additions and 1 deletions
|
|
@ -131,7 +131,7 @@ func (b *Buffer) grow(n int) int {
|
|||
// slice. We only need m+n <= c to slide, but
|
||||
// we instead let capacity get twice as large so we
|
||||
// don't spend all our time copying.
|
||||
copy(b.buf[:], b.buf[b.off:])
|
||||
copy(b.buf, b.buf[b.off:])
|
||||
} else if c > maxInt-c-n {
|
||||
panic(ErrTooLarge)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue