Commit ba7d04e2 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Some asserts to guard against trouble.


git-svn-id: http://www.varnish-cache.org/svn/trunk@327 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 6d431c63
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment