From 74093f0508352aa7d8f67acb24bfa5ae830bcafa Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 13 Feb 2019 22:41:12 +0000 Subject: [PATCH] Remove pointer indirection on chunk bstream (#499) It isn't necessary since the member is never changed after initialization. Signed-off-by: Bryan Boreham --- chunkenc/chunk.go | 4 ++-- chunkenc/xor.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chunkenc/chunk.go b/chunkenc/chunk.go index 4c85fa054..12dc75403 100644 --- a/chunkenc/chunk.go +++ b/chunkenc/chunk.go @@ -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{}} }, }, } diff --git a/chunkenc/xor.go b/chunkenc/xor.go index 77cc3208b..1518772b3 100644 --- a/chunkenc/xor.go +++ b/chunkenc/xor.go @@ -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,