r493 - trunk/varnish-cache/lib/libvarnish

phk at projects.linpro.no phk at projects.linpro.no
Tue Jul 18 15:18:51 CEST 2006


Author: phk
Date: 2006-07-18 15:18:50 +0200 (Tue, 18 Jul 2006)
New Revision: 493

Modified:
   trunk/varnish-cache/lib/libvarnish/binary_heap.c
Log:
Fix the Parent calculation


Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/binary_heap.c	2006-07-18 12:46:23 UTC (rev 492)
+++ trunk/varnish-cache/lib/libvarnish/binary_heap.c	2006-07-18 13:18:50 UTC (rev 493)
@@ -33,7 +33,7 @@
 	unsigned		granularity;
 };
 
-#define PARENT(u)	(((u) - 1) / 2)
+#define PARENT(u)	((u) / 2)
 #define CHILD(u,n)	((u) * 2 + (n))
 
 /* Implementation ----------------------------------------------------*/
@@ -43,6 +43,7 @@
 {
 	assert(bh->magic == BINHEAP_MAGIC);
 	assert(u < bh->next);
+	assert(bh->array[u] != NULL);
 	if (bh->update == NULL)
 		return;
 	bh->update(bh->priv, bh->array[u], u);




More information about the varnish-commit mailing list