X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=prio-queue.c;h=d3f488cb05f29bc90e4e03810d9bf4b972d0834f;hb=dcb11fc6225edbe2bd7af63eb550b739e7f4a074;hp=a07845187233e429e00138cce7ade42e97a40d4b;hpb=21a3e5016bb218dc9b016284c88ba685bc446b70;p=thirdparty%2Fgit.git 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; +}