1
0
mirror of https://github.com/golang/go synced 2024-11-24 21:00:09 -07:00

bufio: fix optimisation test

Fixes #949.

R=rsc
CC=golang-dev
https://golang.org/cl/1886046
This commit is contained in:
Andrew Gerrand 2010-07-27 17:22:45 +10:00
parent fc4ba1546c
commit 4501e18aa5

View File

@ -392,7 +392,7 @@ func (b *Writer) Write(p []byte) (nn int, err os.Error) {
}
n = b.Available()
}
if b.Available() == 0 && len(p) >= len(b.buf) {
if b.Buffered() == 0 && len(p) >= len(b.buf) {
// Large write, empty buffer.
// Write directly from p to avoid copy.
n, b.err = b.wr.Write(p)