From: Kyle Consalus Date: Wed, 5 May 2010 16:57:53 +0000 (-0700) Subject: Conversion from loop to copy(). X-Git-Tag: weekly.2010-05-27~114 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=24bfd652eefab775dd9055abffc3a55a0eca5d9c;p=gostls13.git Conversion from loop to copy(). R=golang-dev, gri CC=golang-dev https://golang.org/cl/1072041 --- 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])