aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/strings
diff options
context:
space:
mode:
authorNigel Tao <nigeltao@golang.org>2011-05-15 13:14:10 -0700
committerNigel Tao <nigeltao@golang.org>2011-05-15 13:14:10 -0700
commit77d66f41314667226d2c385d7d3cfa6314e31919 (patch)
tree84b64b135865fb84e9a69eb7c9653c339fa9cdb7 /src/pkg/strings
parentd49844bcce59409a88d889b3a5fdd7ca59f19c4e (diff)
downloadgo-77d66f41314667226d2c385d7d3cfa6314e31919.tar.xz
strings: make Reader.Read use copy instead of an explicit loop.
R=r, bradfitz, r CC=golang-dev https://golang.org/cl/4529064
Diffstat (limited to 'src/pkg/strings')
-rw-r--r--src/pkg/strings/reader.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/pkg/strings/reader.go b/src/pkg/strings/reader.go
index 914faa0035..4eae90e73a 100644
--- a/src/pkg/strings/reader.go
+++ b/src/pkg/strings/reader.go
@@ -18,10 +18,7 @@ func (r *Reader) Read(b []byte) (n int, err os.Error) {
if len(s) == 0 {
return 0, os.EOF
}
- for n < len(s) && n < len(b) {
- b[n] = s[n]
- n++
- }
+ n = copy(b, s)
*r = s[n:]
return
}