diff options
| author | Kyle Consalus <consalus@gmail.com> | 2010-05-05 09:57:53 -0700 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2010-05-05 09:57:53 -0700 |
| commit | 24bfd652eefab775dd9055abffc3a55a0eca5d9c (patch) | |
| tree | 7f6e969fa8764cf8c180334176cb2ac6ee1e3cc1 /src/pkg/strings/strings.go | |
| parent | 5789c86fc09354279c2d3531b9349f11e2bee726 (diff) | |
| download | go-24bfd652eefab775dd9055abffc3a55a0eca5d9c.tar.xz | |
Conversion from loop to copy().
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/1072041
Diffstat (limited to 'src/pkg/strings/strings.go')
| -rw-r--r-- | src/pkg/strings/strings.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/pkg/strings/strings.go b/src/pkg/strings/strings.go index 90417f811d..b6d84d07aa 100644 --- a/src/pkg/strings/strings.go +++ b/src/pkg/strings/strings.go @@ -275,9 +275,7 @@ func Map(mapping func(rune int) int, s string) string { // Grow the buffer. maxbytes = maxbytes*2 + utf8.UTFMax nb := make([]byte, maxbytes) - for i, c := range b[0:nbytes] { - nb[i] = c - } + copy(nb, b[0:nbytes]) b = nb } nbytes += utf8.EncodeRune(rune, b[nbytes:maxbytes]) |
