aboutsummaryrefslogtreecommitdiffstats
path: root/prio-queue.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-18 18:23:52 +0900
committerJunio C Hamano <gitster@pobox.com>2018-11-18 18:23:52 +0900
commit62ca33e02a4ea93dd59538ac986a082430253b27 (patch)
treeb5f5af9c87a64536f0e7ada9e0066e4f5d29af4e /prio-queue.c
parentTenth batch for 2.20 (diff)
parentt6012: make rev-list tests more interesting (diff)
downloadgit-62ca33e02a4ea93dd59538ac986a082430253b27.tar.gz
git-62ca33e02a4ea93dd59538ac986a082430253b27.zip
Merge branch 'ds/reachable-topo-order'
The revision walker machinery learned to take advantage of the commit generation numbers stored in the commit-graph file. * ds/reachable-topo-order: t6012: make rev-list tests more interesting revision.c: generation-based topo-order algorithm commit/revisions: bookkeeping before refactoring revision.c: begin refactoring --topo-order logic test-reach: add rev-list tests test-reach: add run_three_modes method prio-queue: add 'peek' operation
Diffstat (limited to 'prio-queue.c')
-rw-r--r--prio-queue.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/prio-queue.c b/prio-queue.c
index a078451872..d3f488cb05 100644
--- a/prio-queue.c
+++ b/prio-queue.c
@@ -85,3 +85,12 @@ void *prio_queue_get(struct prio_queue *queue)
}
return result;
}
+
+void *prio_queue_peek(struct prio_queue *queue)
+{
+ if (!queue->nr)
+ return NULL;
+ if (!queue->compare)
+ return queue->array[queue->nr - 1].data;
+ return queue->array[0].data;
+}