]> Cypherpunks repositories - gostls13.git/commitdiff
bufio: fix optimisation test
authorAndrew Gerrand <adg@golang.org>
Tue, 27 Jul 2010 07:22:45 +0000 (17:22 +1000)
committerAndrew Gerrand <adg@golang.org>
Tue, 27 Jul 2010 07:22:45 +0000 (17:22 +1000)
Fixes #949.

R=rsc
CC=golang-dev
https://golang.org/cl/1886046

src/pkg/bufio/bufio.go

index 6a73c41ef5d2a4450af6d58fd2b0319fe6f6dbd3..e73f082890eb7680f11a15e467d52388acac782c 100644 (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)