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

View file

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