• Derrick Stolee's avatar
    prio-queue: add 'peek' operation · aca4240f
    Derrick Stolee authored
    When consuming a priority queue, it can be convenient to inspect
    the next object that will be dequeued without actually dequeueing
    it. Our existing library did not have such a 'peek' operation, so
    add it as prio_queue_peek().
    
    Add a reference-level comparison in t/helper/test-prio-queue.c
    so this method is exercised by t0009-prio-queue.sh. Further, add
    a test that checks the behavior when the compare function is NULL
    (i.e. the queue becomes a stack).
    Signed-off-by: Derrick Stolee's avatarDerrick Stolee <dstolee@microsoft.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    aca4240f
prio-queue.h 1.66 KB