Commit 77d66f41 authored by Nigel Tao's avatar Nigel Tao

strings: make Reader.Read use copy instead of an explicit loop.

R=r, bradfitz, r
CC=golang-dev
https://golang.org/cl/4529064
parent d49844bc
......@@ -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
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment