aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/bytes/bytes.go
diff options
context:
space:
mode:
authorEvan Shaw <chickencha@gmail.com>2013-08-27 09:21:08 +1000
committerAndrew Gerrand <adg@golang.org>2013-08-27 09:21:08 +1000
commitf033d988b1926215f59aa1eee37c05e59adbac02 (patch)
treeda678982adbbd376f324f493530e8aa643bac1f3 /src/pkg/bytes/bytes.go
parentb2e937970b27386951fac2e8d03015c62276a19c (diff)
downloadgo-f033d988b1926215f59aa1eee37c05e59adbac02.tar.xz
bytes, strings: use copy in Repeat
R=golang-dev, dave, bradfitz, adg CC=golang-dev https://golang.org/cl/13249043
Diffstat (limited to 'src/pkg/bytes/bytes.go')
-rw-r--r--src/pkg/bytes/bytes.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/pkg/bytes/bytes.go b/src/pkg/bytes/bytes.go
index 405b10a1db..01a5d9ae4e 100644
--- a/src/pkg/bytes/bytes.go
+++ b/src/pkg/bytes/bytes.go
@@ -375,10 +375,7 @@ func Repeat(b []byte, count int) []byte {
nb := make([]byte, len(b)*count)
bp := 0
for i := 0; i < count; i++ {
- for j := 0; j < len(b); j++ {
- nb[bp] = b[j]
- bp++
- }
+ bp += copy(nb[bp:], b)
}
return nb
}