From: Andrew Gerrand Date: Tue, 27 Jul 2010 07:22:45 +0000 (+1000) Subject: bufio: fix optimisation test X-Git-Tag: weekly.2010-07-29~21 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4501e18aa5cc365016f58f9f052eb3ee5940cea3;p=gostls13.git bufio: fix optimisation test Fixes #949. R=rsc CC=golang-dev https://golang.org/cl/1886046 --- diff --git a/src/pkg/bufio/bufio.go b/src/pkg/bufio/bufio.go index 6a73c41ef5..e73f082890 100644 --- a/src/pkg/bufio/bufio.go +++ b/src/pkg/bufio/bufio.go @@ -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)