]> Cypherpunks repositories - gostls13.git/commitdiff
bytes: removed unnecessary slicing on copy
authorGabriel Aszalos <gabriel.aszalos@gmail.com>
Mon, 18 Sep 2017 15:07:21 +0000 (17:07 +0200)
committerJoe Tsai <thebrokentoaster@gmail.com>
Mon, 18 Sep 2017 16:48:34 +0000 (16:48 +0000)
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>

src/bytes/buffer.go

index 67566a13d9288593b4310505afc7ef8193c6ad47..099e431a3625736eced984b3dbedcd1241eb00bf 100644 (file)
@@ -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 {