From 8a9d23e4462aa19a17a3de463ff8e408656057af Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 29 Sep 2015 20:41:29 +0200 Subject: [PATCH] prioq: never shuffle identical entries Skip shuffling identical entries in shuffle_up(), just like we already do in shuffle_down(). --- src/basic/prioq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/prioq.c b/src/basic/prioq.c index b89888be0e8..5e567b181d3 100644 --- a/src/basic/prioq.c +++ b/src/basic/prioq.c @@ -101,7 +101,7 @@ static unsigned shuffle_up(Prioq *q, unsigned idx) { k = (idx-1)/2; - if (q->compare_func(q->items[k].data, q->items[idx].data) < 0) + if (q->compare_func(q->items[k].data, q->items[idx].data) <= 0) break; swap(q, idx, k);