aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/cache
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-03-01 19:14:48 +0100
committerGitHub <noreply@github.com>2018-03-01 19:14:48 +0100
commitd8d17e72525d359044192b998b11926a4eecc2c4 (patch)
treed9607299f340ba352b0753679d2e5b1b0ce457ab /plumbing/cache
parent4397264e391b45a8eac147cc7373189d55c640cc (diff)
parente850aea5005fdb2a74d7dcd3267dac4a3612df8a (diff)
downloadgo-git-d8d17e72525d359044192b998b11926a4eecc2c4.tar.gz
Merge pull request #766 from mvdan/patches
Unused params, unused code, make Go tip's vet happy
Diffstat (limited to 'plumbing/cache')
-rw-r--r--plumbing/cache/queue.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/plumbing/cache/queue.go b/plumbing/cache/queue.go
deleted file mode 100644
index 85413e0..0000000
--- a/plumbing/cache/queue.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package cache
-
-import "gopkg.in/src-d/go-git.v4/plumbing"
-
-// queue is a basic FIFO queue based on a circular list that resize as needed.
-type queue struct {
- elements []plumbing.Hash
- size int
- head int
- tail int
- count int
-}
-
-// newQueue returns a queue with the specified initial size
-func newQueue(size int) *queue {
- return &queue{
- elements: make([]plumbing.Hash, size),
- size: size,
- }
-}
-
-// Push adds a node to the queue.
-func (q *queue) Push(h plumbing.Hash) {
- if q.head == q.tail && q.count > 0 {
- elements := make([]plumbing.Hash, len(q.elements)+q.size)
- copy(elements, q.elements[q.head:])
- copy(elements[len(q.elements)-q.head:], q.elements[:q.head])
- q.head = 0
- q.tail = len(q.elements)
- q.elements = elements
- }
- q.elements[q.tail] = h
- q.tail = (q.tail + 1) % len(q.elements)
- q.count++
-}
-
-// Pop removes and returns a Hash from the queue in first to last order.
-func (q *queue) Pop() plumbing.Hash {
- if q.count == 0 {
- return plumbing.ZeroHash
- }
- node := q.elements[q.head]
- q.head = (q.head + 1) % len(q.elements)
- q.count--
- return node
-}