diff options
author | Kyle Consalus <consalus@gmail.com> | 2010-05-05 09:57:53 -0700 |
---|---|---|
committer | Kyle Consalus <consalus@gmail.com> | 2010-05-05 09:57:53 -0700 |
commit | 83e7272c4f2f1af80c7f55cea733c9d3bb8435f6 (patch) | |
tree | d9d14eb5fa9f4a12ede5e5d5d3bbb5e82a04d558 | |
parent | 773d17e331fcf20203f800920d53e7f78534e6b4 (diff) | |
download | golang-83e7272c4f2f1af80c7f55cea733c9d3bb8435f6.tar.gz |
Conversion from loop to copy().
R=golang-dev, gri
CC=golang-dev
http://codereview.appspot.com/1072041
Committer: Robert Griesemer <gri@golang.org>
-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 90417f811..b6d84d07a 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]) |