mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
io: drop one allocation from NewBufBinWriter
This commit is contained in:
parent
a68a8aa8fc
commit
2e39f1a1e3
1 changed files with 4 additions and 3 deletions
|
@ -13,13 +13,14 @@ var ErrDrained = errors.New("buffer already drained")
|
|||
// writes via Bytes().
|
||||
type BufBinWriter struct {
|
||||
*BinWriter
|
||||
buf *bytes.Buffer
|
||||
buf bytes.Buffer
|
||||
}
|
||||
|
||||
// NewBufBinWriter makes a BufBinWriter with an empty byte buffer.
|
||||
func NewBufBinWriter() *BufBinWriter {
|
||||
b := new(bytes.Buffer)
|
||||
return &BufBinWriter{BinWriter: NewBinWriterFromIO(b), buf: b}
|
||||
b := new(BufBinWriter)
|
||||
b.BinWriter = NewBinWriterFromIO(&b.buf)
|
||||
return b
|
||||
}
|
||||
|
||||
// Len returns the number of bytes of the unread portion of the buffer.
|
||||
|
|
Loading…
Reference in a new issue