From 0d2aeddcb81e3412b4131474a4f200ce985f3a61 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 23 Sep 2007 12:46:52 +0000 Subject: [PATCH] Polish, including use of CHECK_OBJ_ORNULL() git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1983 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_center.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index 809cb0e1..dd9ea6af 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -511,13 +511,14 @@ cnt_lookup(struct sess *sp) p = WS_Alloc(sp->http->ws, sizeof(const char *) * (sp->nhashptr + 1)); XXXAN(p); + /* Align pointer properly (?) */ u = (uintptr_t)p; u &= sizeof(const char *) - 1; if (u) p += sizeof(const char *) - u; sp->hashptr = (void*)p; - VCL_hash_method(sp); /* XXX: no-op for now */ + VCL_hash_method(sp); /* XXX check error */ } @@ -818,15 +819,11 @@ CNT_Session(struct sess *sp) * pointers still pointing to the things we expect. */ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (sp->obj != NULL) - CHECK_OBJ(sp->obj, OBJECT_MAGIC); + CHECK_OBJ_ORNULL(sp->obj, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); - if (w->nobj != NULL) - CHECK_OBJ(w->nobj, OBJECT_MAGIC); - if (w->nobjhead != NULL) - CHECK_OBJ(w->nobjhead, OBJHEAD_MAGIC); - if (sp->backend != NULL) - CHECK_OBJ(sp->backend, BACKEND_MAGIC); + CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC); + CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC); + CHECK_OBJ_ORNULL(sp->backend, BACKEND_MAGIC); switch (sp->step) { #define STEP(l,u) case STP_##u: done = cnt_##l(sp); break; @@ -834,10 +831,8 @@ CNT_Session(struct sess *sp) #undef STEP default: INCOMPL(); } - if (w->nobj != NULL) - CHECK_OBJ(w->nobj, OBJECT_MAGIC); - if (w->nobjhead != NULL) - CHECK_OBJ(w->nobjhead, OBJHEAD_MAGIC); + CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC); + CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC); } assert(!isnan(w->used)); WSL_Flush(w); -- 2.39.5