mirror of
https://github.com/golang/go
synced 2024-11-22 02:24:41 -07:00
bufio: make Flush a no-op when the buffer is empty
R=r CC=golang-dev https://golang.org/cl/4119048
This commit is contained in:
parent
3bfd35b72e
commit
9173a09530
@ -385,6 +385,9 @@ func (b *Writer) Flush() os.Error {
|
|||||||
if b.err != nil {
|
if b.err != nil {
|
||||||
return b.err
|
return b.err
|
||||||
}
|
}
|
||||||
|
if b.n == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
n, e := b.wr.Write(b.buf[0:b.n])
|
n, e := b.wr.Write(b.buf[0:b.n])
|
||||||
if n < b.n && e == nil {
|
if n < b.n && e == nil {
|
||||||
e = io.ErrShortWrite
|
e = io.ErrShortWrite
|
||||||
|
Loading…
Reference in New Issue
Block a user