From 436d1db35788bda2bc204e26461797bfd4decfd2 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 25 Sep 2007 07:40:01 +0000 Subject: [PATCH] Misc changes: A couple of XXX comments Some returnvalue asserts Some pdiff() uses Change WRK_Flush() to return unsigned git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2028 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_hash.c | 2 +- varnish-cache/bin/varnishd/cache_pool.c | 2 +- varnish-cache/bin/varnishd/cache_synthetic.c | 2 +- varnish-cache/bin/varnishd/mgt_vcc.c | 12 ++++++++++-- varnish-cache/bin/varnishd/stevedore.c | 7 +++++-- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index c3b21c5d..3384710e 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -490,7 +490,7 @@ void PipeSession(struct sess *sp); void WRK_Init(void); void WRK_QueueSession(struct sess *sp); void WRK_Reset(struct worker *w, int *fd); -int WRK_Flush(struct worker *w); +unsigned WRK_Flush(struct worker *w); unsigned WRK_Write(struct worker *w, const void *ptr, int len); unsigned WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf); #ifdef HAVE_SENDFILE diff --git a/varnish-cache/bin/varnishd/cache_hash.c b/varnish-cache/bin/varnishd/cache_hash.c index e72fff87..eccb479f 100644 --- a/varnish-cache/bin/varnishd/cache_hash.c +++ b/varnish-cache/bin/varnishd/cache_hash.c @@ -146,7 +146,7 @@ HSH_Copy(const struct sess *sp, const struct objhead *obj) assert(obj->hashlen >= sp->lhashptr); b = obj->hash; for (u = 0; u < sp->ihashptr; u += 2) { - v = sp->hashptr[u + 1] - sp->hashptr[u]; + v = pdiff(sp->hashptr[u], sp->hashptr[u + 1]); memcpy(b, sp->hashptr[u], v); b += v; *b++ = '#'; diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index 459cf669..d66ed3c7 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -91,7 +91,7 @@ WRK_Reset(struct worker *w, int *fd) w->wfd = fd; } -int +unsigned WRK_Flush(struct worker *w) { int i; diff --git a/varnish-cache/bin/varnishd/cache_synthetic.c b/varnish-cache/bin/varnishd/cache_synthetic.c index caa17c6e..63e5d068 100644 --- a/varnish-cache/bin/varnishd/cache_synthetic.c +++ b/varnish-cache/bin/varnishd/cache_synthetic.c @@ -91,7 +91,7 @@ SYN_ErrorPage(struct sess *sp, int status, const char *reason, int ttl) TAILQ_INSERT_TAIL(&sp->obj->store, st, list); /* generate body */ - vsb_new(&vsb, (char *)st->ptr, st->space, VSB_FIXEDLEN); + AN(vsb_new(&vsb, (char *)st->ptr, st->space, VSB_FIXEDLEN)); vsb_printf(&vsb, "\n" "name, dlerror()); cli_result(cli, CLIS_CANT); - dlclose(dlh); + AZ(dlclose(dlh)); } else { src = sym; cli_out(cli, src[0]); /* cli_out(cli, src[1]); */ - dlclose(dlh); + AZ(dlclose(dlh)); } } } diff --git a/varnish-cache/bin/varnishd/stevedore.c b/varnish-cache/bin/varnishd/stevedore.c index 132d54cd..9fa75f3b 100644 --- a/varnish-cache/bin/varnishd/stevedore.c +++ b/varnish-cache/bin/varnishd/stevedore.c @@ -94,9 +94,12 @@ STV_free(struct storage *st) static int cmp_storage(const struct stevedore *s, const char *p, const char *q) { - if (strlen(s->name) != q - p) + unsigned u; + + u = pdiff(p, q); + if (strlen(s->name) != u) return (1); - if (strncmp(s->name, p, q - p)) + if (strncmp(s->name, p, u)) return (1); return (0); } -- 2.39.5