From: Martin Mares Date: Fri, 2 Nov 2001 21:34:08 +0000 (+0000) Subject: HEAP_DELETE: Copy the `pos' parameter to a temporary variable as soon X-Git-Tag: holmes-import~1463 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=afd04a3bdf5a0f3511a92dd8ddfe610dafea32f1;p=libucw.git 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. --- 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 \