Skip to content

Commit 24bfd65

Browse files
kconsgriesemer
authored andcommitted
Conversion from loop to copy().
R=golang-dev, gri CC=golang-dev https://golang.org/cl/1072041
1 parent 5789c86 commit 24bfd65

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/pkg/strings/strings.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ func Map(mapping func(rune int) int, s string) string {
275275
// Grow the buffer.
276276
maxbytes = maxbytes*2 + utf8.UTFMax
277277
nb := make([]byte, maxbytes)
278-
for i, c := range b[0:nbytes] {
279-
nb[i] = c
280-
}
278+
copy(nb, b[0:nbytes])
281279
b = nb
282280
}
283281
nbytes += utf8.EncodeRune(rune, b[nbytes:maxbytes])

0 commit comments

Comments
 (0)