Skip to content

Commit

Permalink
Conversion from loop to copy().
Browse files Browse the repository at this point in the history
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/1072041
  • Loading branch information
kcons authored and griesemer committed May 5, 2010
1 parent 5789c86 commit 24bfd65
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/pkg/strings/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 24bfd65

Please sign in to comment.