From afd04a3bdf5a0f3511a92dd8ddfe610dafea32f1 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 2 Nov 2001 21:34:08 +0000 Subject: [PATCH] HEAP_DELETE: Copy the `pos' parameter to a temporary variable as soon soon as possible to avoid problems with callers supplying us with expressions which could change during heap operations. --- lib/heap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/heap.h b/lib/heap.h index 268cc257..7be54cfa 100644 --- a/lib/heap.h +++ b/lib/heap.h @@ -71,9 +71,9 @@ do { \ uns j, l, u; \ type x; \ - swap(heap,pos,num,x); \ - num--; \ j = pos; \ + swap(heap,j,num,x); \ + num--; \ if (less(heap[j], heap[num+1])) \ HEAP_BUBBLE_UP_J(heap,num,less,swap) \ else \ -- 2.39.2