Skip to content
Snippets Groups Projects
Unverified Commit 6725151a authored by Junegunn Choi's avatar Junegunn Choi
Browse files

Remove unnecessary copy of Chunk slice

parent d4f3d5a1
No related branches found
No related tags found
No related merge requests found
......@@ -79,15 +79,8 @@ func (cl *ChunkList) Snapshot() ([]*Chunk, int) {
// Duplicate the last chunk
if cnt := len(ret); cnt > 0 {
ret[cnt-1] = ret[cnt-1].dupe()
newChunk := *ret[cnt-1]
ret[cnt-1] = &newChunk
}
return ret, cl.count
}
func (c *Chunk) dupe() *Chunk {
newChunk := make(Chunk, len(*c))
for idx, ptr := range *c {
newChunk[idx] = ptr
}
return &newChunk
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment