mirror of
https://github.com/golang/go
synced 2024-11-22 01:44:40 -07:00
Conversion from loop to copy().
R=golang-dev, gri CC=golang-dev https://golang.org/cl/1072041
This commit is contained in:
parent
5789c86fc0
commit
24bfd652ee
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user