R=gri
CC=golang-dev
https://golang.org/cl/2763041
This commit is contained in:
Russ Cox 2010-10-26 21:52:54 -07:00
parent e48c0fb562
commit d86ab015f7
45 changed files with 68 additions and 199 deletions

View file

@ -325,9 +325,7 @@ func Map(mapping func(rune int) int, s []byte) []byte {
// 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])