Skip to content
Myr

Remove unnecessary copy of Chunk slice

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent d4f3d5a · Browse files · 1 file+2 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−9 removed

  • other:+2 added−9 removed

1 file+2 added−9 removed

modified:src/chunklist.go+2 added-9 removed
77 unmodified lines
78 copy(ret, cl.chunks)7980 // Duplicate the last chunk81 if cnt := len(ret); cnt > 0 {82 ret[cnt-1] = ret[cnt-1].dupe()82 newChunk := *ret[cnt-1]83 ret[cnt-1] = &newChunk84 }85 return ret, cl.count86}8687func (c *Chunk) dupe() *Chunk {88 newChunk := make(Chunk, len(*c))89 for idx, ptr := range *c {90 newChunk[idx] = ptr91 }92 return &newChunk93}