summaryrefslogtreecommitdiff
path: root/prio-queue.c
diff options
context:
space:
mode:
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 a078451..d3f488c 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;
+}