From 77d66f41314667226d2c385d7d3cfa6314e31919 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sun, 15 May 2011 13:14:10 -0700 Subject: [PATCH] strings: make Reader.Read use copy instead of an explicit loop. R=r, bradfitz, r CC=golang-dev https://golang.org/cl/4529064 --- src/pkg/strings/reader.go | 5 +---- 1 file changed, 1 insertion(+), 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 }