From 34b26adb24ea63e325e3e75437988264ba060117 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Mon, 22 May 2000 19:47:01 +0000 Subject: [PATCH] heap invariant INSIST did the wrong thing in the border case of a heap item and its parent having identical priority --- lib/isc/heap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/isc/heap.c b/lib/isc/heap.c index 6e36be7939..ca577e4cee 100644 --- a/lib/isc/heap.c +++ b/lib/isc/heap.c @@ -48,12 +48,12 @@ /* * When the heap is in a consistent state, the following invariant - * holds true: for every element i > 1, heap_parent(i) has a higher - * priority than i. + * holds true: for every element i > 1, heap_parent(i) has a priority + * higher than or equal to that of i. */ #define HEAPCONDITION(i) ((i) == 1 || \ - heap->compare(heap->array[heap_parent(i)], \ - heap->array[(i)])) + ! heap->compare(heap->array[(i)], \ + heap->array[heap_parent(i)])) struct isc_heap { unsigned int magic;