t6050-replace: use some long option names
[gitweb.git] / prio-queue.c
index f2a4973a01a16b1614ac5d80a3f5c88f490f76a6..c9f8c6d2532b23ff07194c99c6f4121a7000bed4 100644 (file)
@@ -2,6 +2,19 @@
 #include "commit.h"
 #include "prio-queue.h"
 
+void prio_queue_reverse(struct prio_queue *queue)
+{
+       int i, j;
+
+       if (queue->compare != NULL)
+               die("BUG: prio_queue_reverse() on non-LIFO queue");
+       for (i = 0; i <= (j = (queue->nr - 1) - i); i++) {
+               struct commit *swap = queue->array[i];
+               queue->array[i] = queue->array[j];
+               queue->array[j] = swap;
+       }
+}
+
 void clear_prio_queue(struct prio_queue *queue)
 {
        free(queue->array);