/
uis
/
git
/
x
/
uis
/
git
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
prio-queue: add 'peek' operation
[git/git.git]
/
prio-queue.c
diff --git
a/prio-queue.c
b/prio-queue.c
index
a078451
..
d3f488c
100644
(file)
--- 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;
+}