From d81704c188ac2b71a9e8c3a0e5c93a5424de26d0 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 5 Jul 2006 13:09:01 +0000 Subject: [PATCH] Some asserts to guard against trouble. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@327 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/storage_file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/storage_file.c b/varnish-cache/bin/varnishd/storage_file.c index a4926f3a..90c276e7 100644 --- a/varnish-cache/bin/varnishd/storage_file.c +++ b/varnish-cache/bin/varnishd/storage_file.c @@ -268,10 +268,9 @@ alloc_smf(struct smf_sc *sc, size_t bytes) { struct smf *sp, *sp2; - TAILQ_FOREACH(sp, &sc->free, status) { + TAILQ_FOREACH(sp, &sc->free, status) if (sp->size >= bytes) break; - } if (sp == NULL) return (sp); @@ -478,6 +477,7 @@ smf_alloc(struct stevedore *st, size_t size) size &= ~(sc->pagesize - 1); AZ(pthread_mutex_lock(&sc->mtx)); smf = alloc_smf(sc, size); + assert(smf->size == size); AZ(pthread_mutex_unlock(&sc->mtx)); assert(smf != NULL); smf->s.space = size; @@ -506,6 +506,7 @@ smf_trim(struct storage *s, size_t size) if (smf->size > size) { AZ(pthread_mutex_lock(&sc->mtx)); trim_smf(smf, size); + assert(smf->size == size); AZ(pthread_mutex_unlock(&sc->mtx)); smf->s.space = size; } -- 2.39.5