mirror of https://github.com/golang/go.git
strings: make Reader.Read use copy instead of an explicit loop.
R=r, bradfitz, r CC=golang-dev https://golang.org/cl/4529064
This commit is contained in:
parent
d49844bcce
commit
77d66f4131
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue