r566 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sun Jul 23 00:01:04 CEST 2006


Author: phk
Date: 2006-07-23 00:01:04 +0200 (Sun, 23 Jul 2006)
New Revision: 566

Modified:
   trunk/varnish-cache/bin/varnishd/hash_classic.c
Log:
reorg a little bit.


Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_classic.c	2006-07-22 21:20:08 UTC (rev 565)
+++ trunk/varnish-cache/bin/varnishd/hash_classic.c	2006-07-22 22:01:04 UTC (rev 566)
@@ -177,16 +177,16 @@
 	CAST_OBJ_NOTNULL(he, oh->hashpriv, HCL_ENTRY_MAGIC);
 	mtx = he->mtx;
 	AZ(pthread_mutex_lock(&hcl_mutex[mtx]));
-	if (--he->refcnt == 0) {
-		free(he->key1);
-		free(he->key2);
-		TAILQ_REMOVE(&hcl_head[he->hash], he, list);
-		free(he);
-		ret = 0;
-	} else
-		ret = 1;
+	if (--he->refcnt >= 0) {
+		AZ(pthread_mutex_unlock(&hcl_mutex[mtx]));
+		return (1)
+	}
+	TAILQ_REMOVE(&hcl_head[he->hash], he, list);
 	AZ(pthread_mutex_unlock(&hcl_mutex[mtx]));
-	return (ret);
+	free(he->key1);
+	free(he->key2);
+	free(he);
+	return (0);
 }
 
 /*--------------------------------------------------------------------*/




More information about the varnish-commit mailing list