Remove pointer indirection on chunk bstream (#499)

It isn't necessary since the member is never changed after
initialization.

Signed-off-by: Bryan Boreham <bryan@weave.works>
This commit is contained in:
Bryan Boreham 2019-02-13 22:41:12 +00:00 committed by Goutham Veeramachaneni
parent 109252f3aa
commit 74093f0508
2 changed files with 5 additions and 5 deletions

View file

@ -52,7 +52,7 @@ type Chunk interface {
func FromData(e Encoding, d []byte) (Chunk, error) {
switch e {
case EncXOR:
return &XORChunk{b: &bstream{count: 0, stream: d}}, nil
return &XORChunk{b: bstream{count: 0, stream: d}}, nil
}
return nil, fmt.Errorf("unknown chunk encoding: %d", e)
}
@ -94,7 +94,7 @@ func NewPool() Pool {
return &pool{
xor: sync.Pool{
New: func() interface{} {
return &XORChunk{b: &bstream{}}
return &XORChunk{b: bstream{}}
},
},
}

View file

@ -51,13 +51,13 @@ import (
// XORChunk holds XOR encoded sample data.
type XORChunk struct {
b *bstream
b bstream
}
// NewXORChunk returns a new chunk with XOR encoding of the given size.
func NewXORChunk() *XORChunk {
b := make([]byte, 2, 128)
return &XORChunk{b: &bstream{stream: b, count: 0}}
return &XORChunk{b: bstream{stream: b, count: 0}}
}
// Encoding returns the encoding type.
@ -89,7 +89,7 @@ func (c *XORChunk) Appender() (Appender, error) {
}
a := &xorAppender{
b: c.b,
b: &c.b,
t: it.t,
v: it.val,
tDelta: it.tDelta,