Browse Source

reallocate in for loop

pull/714/merge
Darien Raymond 7 years ago
parent
commit
afcad409e2
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
  1. 8
      common/buf/writer.go

8
common/buf/writer.go

@ -60,12 +60,12 @@ func (w *BufferedWriter) Write(b []byte) (int, error) {
return w.legacyWriter.Write(b)
}
if w.buffer == nil {
w.buffer = New()
}
totalBytes := 0
for len(b) > 0 {
if w.buffer == nil {
w.buffer = New()
}
nBytes, err := w.buffer.Write(b)
totalBytes += nBytes
if err != nil {

Loading…
Cancel
Save