Skip to content

Commit

Permalink
LineMerger: Remove unused variable mergee.index
Browse files Browse the repository at this point in the history
Found while working on #40
but not directly related.
  • Loading branch information
brawer committed May 18, 2024
1 parent bd246b2 commit e3c3d6e
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions cmd/qrank-builder/linemerger.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func (m *LineMerger) Line() string {

type mergee struct {
scanner LineScanner
index int
name string
}

Expand All @@ -105,23 +104,17 @@ func (h lineMergerHeap) Less(i, j int) bool {

func (h lineMergerHeap) Swap(i, j int) {
h[i], h[j] = h[j], h[i]
h[i].index = i
h[j].index = j
}

func (h *lineMergerHeap) Push(x interface{}) {
n := len(*h)
item := x.(*mergee)
item.index = n
*h = append(*h, item)
*h = append(*h, x.(*mergee))
}

func (h *lineMergerHeap) Pop() interface{} {
old := *h
n := len(old)
item := old[n-1]
old[n-1] = nil // avoid memory leak
item.index = -1
*h = old[0 : n-1]
return item
}

0 comments on commit e3c3d6e

Please sign in to comment.