[master] 203eafe Some stylistic consistency patches from Dridi Boukelmoune who made them with Coccinelle.

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 22 10:17:28 CEST 2014


commit 203eafef5b9c9f03dd29826128e4800a17e28d39
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Apr 22 08:16:41 2014 +0000

    Some stylistic consistency patches from Dridi Boukelmoune
    who made them with Coccinelle.
    
    Thanks!

diff --git a/bin/varnishd/cache/cache_cli.c b/bin/varnishd/cache/cache_cli.c
index ca9da16..99b781c 100644
--- a/bin/varnishd/cache/cache_cli.c
+++ b/bin/varnishd/cache/cache_cli.c
@@ -214,7 +214,7 @@ ccf_panic(struct cli *cli, const char * const *av, void *priv)
 	(void)cli;
 	(void)av;
 	(void)priv;
-	assert(!strcmp("", "You asked for it"));
+	AZ(strcmp("", "You asked for it"));
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 5aa85ee..a246985 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -302,7 +302,7 @@ ESI_Deliver(struct req *req)
 		i = VGZ_Gunzip(vgz, &dp, &dl);
 		assert(i == VGZ_OK);
 		assert(VGZ_IbufEmpty(vgz));
-		assert(dl == 0);
+		AZ(dl);
 	}
 
 	st = VTAILQ_FIRST(&req->obj->store);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 8bd0707..b5ecfbe 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -98,7 +98,7 @@ exp_when(const struct object *o)
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
 
 	when = o->exp.t_origin + o->exp.ttl + o->exp.grace + o->exp.keep;
-	assert(!isnan(when));
+	AZ(isnan(when));
 	return (when);
 }
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index be664e5..5a0a9ff 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -801,7 +801,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 	http_Teardown(bo->beresp);
 
 	if (bo->state == BOS_FINISHED) {
-		assert(!(bo->fetch_objcore->flags & OC_F_FAILED));
+		AZ(bo->fetch_objcore->flags & OC_F_FAILED);
 		HSH_Complete(bo->fetch_objcore);
 		VSLb(bo->vsl, SLT_Length, "%zd", bo->fetch_obj->len);
 		{
diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index 8861e1d..429052d 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -230,7 +230,7 @@ VFP_Fetch_Body(struct busyobj *bo, ssize_t est)
 		AZ(bo->failed);
 		vfps = VFP_Suck(bo, st->ptr + st->len, &l);
 		if (l > 0 && vfps != VFP_ERROR) {
-			assert(!VTAILQ_EMPTY(&bo->fetch_obj->store));
+			AZ(VTAILQ_EMPTY(&bo->fetch_obj->store));
 			VBO_extend(bo, l);
 		}
 		if (st->len == st->space)
diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c
index 9bb5e79..3702827 100644
--- a/bin/varnishd/cache/cache_http1_fsm.c
+++ b/bin/varnishd/cache/cache_http1_fsm.c
@@ -103,7 +103,7 @@ http1_wait(struct sess *sp, struct worker *wrk, struct req *req)
 	AZ(req->vcl);
 	AZ(req->obj);
 	AZ(req->esi_level);
-	assert(!isnan(sp->t_idle));
+	AZ(isnan(sp->t_idle));
 	assert(isnan(req->t_first));
 	assert(isnan(req->t_prev));
 	assert(isnan(req->t_req));
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index 54203af..288d452 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -134,8 +134,8 @@ Lck__Assert(const struct lock *lck, int held)
 		assert(ilck->held);
 		assert(pthread_equal(ilck->owner, pthread_self()));
 	} else {
-		assert(!ilck->held);
-		assert(!pthread_equal(ilck->owner, pthread_self()));
+		AZ(ilck->held);
+		AZ(pthread_equal(ilck->owner, pthread_self()));
 	}
 }
 
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index b6d0500..2518422 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -690,9 +690,9 @@ cnt_recv(struct worker *wrk, struct req *req)
 	AZ(req->obj);
 	AZ(req->objcore);
 
-	assert(!isnan(req->t_first));
-	assert(!isnan(req->t_prev));
-	assert(!isnan(req->t_req));
+	AZ(isnan(req->t_first));
+	AZ(isnan(req->t_prev));
+	AZ(isnan(req->t_req));
 
 	VSLb(req->vsl, SLT_ReqStart, "%s %s",
 	    req->sp->client_addr_str, req->sp->client_port_str);
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 0c010c1..c938b98 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -303,7 +303,7 @@ SES_Delete(struct sess *sp, enum sess_close reason, double now)
 
 	if (isnan(now))
 		now = VTIM_real();
-	assert(!isnan(sp->t_open));
+	AZ(isnan(sp->t_open));
 
 	VSL(SLT_SessClose, sp->vxid, "%s %.3f",
 	    sess_close_2str(sp->reason, 0), now - sp->t_open);
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index af78bfa..d0733d7 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -78,7 +78,7 @@ static inline uint32_t *
 vsl_hdr(enum VSL_tag_e tag, uint32_t *p, unsigned len, uint32_t vxid)
 {
 
-	assert(((uintptr_t)p & 0x3) == 0);
+	AZ((uintptr_t)p & 0x3);
 	assert(tag > SLT__Bogus);
 	assert(tag < SLT__Reserved);
 	AZ(len & ~VSL_LENMASK);
@@ -133,7 +133,7 @@ vsl_get(unsigned len, unsigned records, unsigned flushes)
 		AZ(err);
 	}
 	assert(vsl_ptr < vsl_end);
-	assert(((uintptr_t)vsl_ptr & 0x3) == 0);
+	AZ((uintptr_t)vsl_ptr & 0x3);
 
 	VSC_C_main->shm_writes++;
 	VSC_C_main->shm_flushes += flushes;
@@ -146,7 +146,7 @@ vsl_get(unsigned len, unsigned records, unsigned flushes)
 	p = vsl_ptr;
 	vsl_ptr = VSL_END(vsl_ptr, len);
 	assert(vsl_ptr < vsl_end);
-	assert(((uintptr_t)vsl_ptr & 0x3) == 0);
+	AZ((uintptr_t)vsl_ptr & 0x3);
 
 	*vsl_ptr = VSL_ENDMARKER;
 
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 0018095..e6dd179 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -250,7 +250,7 @@ VCL_Nuke(struct vcls *vcl)
 	ASSERT_CLI();
 	assert(vcl != vcl_active);
 	assert(vcl->conf->discard);
-	assert(vcl->conf->busy == 0);
+	AZ(vcl->conf->busy);
 	VTAILQ_REMOVE(&vcl_head, vcl, list);
 	ctx.method = VCL_MET_FINI;
 	ctx.handling = &hand;
@@ -438,7 +438,7 @@ VCL_##func##_method(struct VCL_conf *vcl, struct worker *wrk,		\
 	vcl_call_method(wrk, req, bo, ws, VCL_MET_ ## upper,		\
 	    vcl->func##_func);						\
 	assert((1U << wrk->handling) & bitmap);				\
-	assert(!((1U << wrk->handling) & ~bitmap));			\
+	AZ((1U << wrk->handling) & ~bitmap);			\
 }
 
 #include "tbl/vcl_returns.h"
diff --git a/bin/varnishd/cache/cache_wrw.c b/bin/varnishd/cache/cache_wrw.c
index a418ea0..09c7e26 100644
--- a/bin/varnishd/cache/cache_wrw.c
+++ b/bin/varnishd/cache/cache_wrw.c
@@ -137,7 +137,7 @@ wrw_prune(struct wrw *wrw, ssize_t bytes)
 		}
 		used += wrw->iov[j].iov_len;
 	}
-	assert(wrw->liov == 0);
+	AZ(wrw->liov);
 }
 
 unsigned
diff --git a/bin/varnishd/hash/hash_critbit.c b/bin/varnishd/hash/hash_critbit.c
index 46f7f95..4e14bdd 100644
--- a/bin/varnishd/hash/hash_critbit.c
+++ b/bin/varnishd/hash/hash_critbit.c
@@ -73,7 +73,7 @@ hcb_build_bittbl(void)
 
 	/* Quick asserts for sanity check */
 	assert(hcb_bits(0x34, 0x34) == 8);
-	assert(hcb_bits(0xaa, 0x55) == 0);
+	AZ(hcb_bits(0xaa, 0x55));
 	assert(hcb_bits(0x01, 0x22) == 2);
 	assert(hcb_bits(0x10, 0x0b) == 3);
 }
@@ -132,7 +132,7 @@ static uintptr_t
 hcb_r_node(struct objhead *n)
 {
 
-	assert(!((uintptr_t)n & (HCB_BIT_NODE|HCB_BIT_Y)));
+	AZ((uintptr_t)n & (HCB_BIT_NODE | HCB_BIT_Y));
 	return (HCB_BIT_NODE | (uintptr_t)n);
 }
 
@@ -141,7 +141,7 @@ hcb_l_node(uintptr_t u)
 {
 
 	assert(u & HCB_BIT_NODE);
-	assert(!(u & HCB_BIT_Y));
+	AZ(u & HCB_BIT_Y);
 	return ((struct objhead *)(u & ~HCB_BIT_NODE));
 }
 
@@ -150,7 +150,7 @@ hcb_r_y(struct hcb_y *y)
 {
 
 	CHECK_OBJ_NOTNULL(y, HCB_Y_MAGIC);
-	assert(!((uintptr_t)y & (HCB_BIT_NODE|HCB_BIT_Y)));
+	AZ((uintptr_t)y & (HCB_BIT_NODE | HCB_BIT_Y));
 	return (HCB_BIT_Y | (uintptr_t)y);
 }
 
@@ -158,7 +158,7 @@ static struct hcb_y *
 hcb_l_y(uintptr_t u)
 {
 
-	assert(!(u & HCB_BIT_NODE));
+	AZ(u & HCB_BIT_NODE);
 	assert(u & HCB_BIT_Y);
 	return ((struct hcb_y *)(u & ~HCB_BIT_Y));
 }
@@ -252,7 +252,7 @@ hcb_insert(struct worker *wrk, struct hcb_root *root, const uint8_t *digest,
 	s2 = 1-s2;
 
 	p = &root->origo;
-	assert(*p != 0);
+	AN(*p);
 
 	while(hcb_is_y(*p)) {
 		y = hcb_l_y(*p);
diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index f977adb..3d71a14 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -116,7 +116,7 @@ mcf_panic(struct cli *cli, const char * const *av, void *priv)
 	(void)cli;
 	(void)av;
 	(void)priv;
-	assert(!strcmp("", "You asked for it"));
+	AZ(strcmp("", "You asked for it"));
 }
 
 static struct cli_proto cli_debug[] = {
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 5dc602e..76b702b 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -300,7 +300,7 @@ cli_stdin_close(void *priv)
 	(void)close(0);
 	(void)close(1);
 	(void)close(2);
-	assert(open("/dev/null", O_RDONLY) == 0);
+	AZ(open("/dev/null", O_RDONLY));
 	assert(open("/dev/null", O_WRONLY) == 1);
 	assert(open("/dev/null", O_WRONLY) == 2);
 
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 30ae453..5e54ed6 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -183,8 +183,7 @@ stv_alloc(struct stevedore *stv, size_t size)
 
 		size >>= 1;
 	}
-	if (st != NULL)
-		CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
+	CHECK_OBJ_ORNULL(st, STORAGE_MAGIC);
 	return (st);
 }
 
@@ -226,8 +225,7 @@ stv_alloc_obj(struct busyobj *bo, size_t size)
 		    EXP_NukeOne(bo, stv->lru) == -1)
 			break;
 	}
-	if (st != NULL)
-		CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
+	CHECK_OBJ_ORNULL(st, STORAGE_MAGIC);
 	return (st);
 }
 
diff --git a/bin/varnishd/storage/stevedore_utils.c b/bin/varnishd/storage/stevedore_utils.c
index 081b93a..a86d57e 100644
--- a/bin/varnishd/storage/stevedore_utils.c
+++ b/bin/varnishd/storage/stevedore_utils.c
@@ -159,7 +159,7 @@ stv_fsspace(int fd, unsigned *bs)
 	/* We use units of the larger of filesystem blocksize and pagesize */
 	if (*bs < bsize)
 		*bs = bsize;
-	xxxassert(*bs % bsize == 0);
+	XXXAZ(*bs % bsize);
 	return (bsize * bavail);
 }
 
@@ -188,7 +188,7 @@ STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx)
 
 	bs = *granularity;
 	fssize = stv_fsspace(fd, &bs);
-	xxxassert(bs % *granularity == 0);
+	XXXAZ(bs % *granularity);
 
 	if ((size == NULL || *size == '\0') && st.st_size != 0) {
 		/*
diff --git a/bin/varnishd/storage/storage_file.c b/bin/varnishd/storage/storage_file.c
index ac0b6c4..c48200c 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
@@ -168,7 +168,7 @@ insfree(struct smf_sc *sc, struct smf *sp)
 	struct smf *sp2;
 	size_t ns;
 
-	assert(sp->alloc == 0);
+	AZ(sp->alloc);
 	assert(sp->flist == NULL);
 	Lck_AssertHeld(&sc->mtx);
 	b = sp->size / sc->pagesize;
@@ -182,7 +182,7 @@ insfree(struct smf_sc *sc, struct smf *sp)
 	ns = b * sc->pagesize;
 	VTAILQ_FOREACH(sp2, sp->flist, status) {
 		assert(sp2->size >= ns);
-		assert(sp2->alloc == 0);
+		AZ(sp2->alloc);
 		assert(sp2->flist == sp->flist);
 		if (sp->offset < sp2->offset)
 			break;
@@ -198,7 +198,7 @@ remfree(const struct smf_sc *sc, struct smf *sp)
 {
 	size_t b;
 
-	assert(sp->alloc == 0);
+	AZ(sp->alloc);
 	assert(sp->flist != NULL);
 	Lck_AssertHeld(&sc->mtx);
 	b = sp->size / sc->pagesize;
@@ -223,7 +223,7 @@ alloc_smf(struct smf_sc *sc, size_t bytes)
 	struct smf *sp, *sp2;
 	size_t b;
 
-	assert(!(bytes % sc->pagesize));
+	AZ(bytes % sc->pagesize);
 	b = bytes / sc->pagesize;
 	if (b >= NBUCKET)
 		b = NBUCKET - 1;
@@ -280,9 +280,9 @@ free_smf(struct smf *sp)
 	struct smf_sc *sc = sp->sc;
 
 	CHECK_OBJ_NOTNULL(sp, SMF_MAGIC);
-	assert(sp->alloc != 0);
+	AN(sp->alloc);
 	assert(sp->size > 0);
-	assert(!(sp->size % sc->pagesize));
+	AZ(sp->size % sc->pagesize);
 	VTAILQ_REMOVE(&sc->used, sp, status);
 	sp->alloc = 0;
 
@@ -324,11 +324,11 @@ trim_smf(struct smf *sp, size_t bytes)
 	struct smf *sp2;
 	struct smf_sc *sc = sp->sc;
 
-	assert(sp->alloc != 0);
+	AN(sp->alloc);
 	assert(bytes > 0);
 	assert(bytes < sp->size);
-	assert(!(bytes % sc->pagesize));
-	assert(!(sp->size % sc->pagesize));
+	AZ(bytes % sc->pagesize);
+	AZ(sp->size % sc->pagesize);
 	CHECK_OBJ_NOTNULL(sp, SMF_MAGIC);
 	sp2 = malloc(sizeof *sp2);
 	XXXAN(sp2);
@@ -353,7 +353,7 @@ new_smf(struct smf_sc *sc, unsigned char *ptr, off_t off, size_t len)
 {
 	struct smf *sp, *sp2;
 
-	assert(!(len % sc->pagesize));
+	AZ(len % sc->pagesize);
 	sp = calloc(sizeof *sp, 1);
 	XXXAN(sp);
 	sp->magic = SMF_MAGIC;
@@ -395,8 +395,8 @@ smf_open_chunk(struct smf_sc *sc, off_t sz, off_t off, off_t *fail, off_t *sum)
 	void *p;
 	off_t h;
 
-	assert(sz != 0);
-	assert(!(sz % sc->pagesize));
+	AN(sz);
+	AZ(sz % sc->pagesize);
 
 	if (*fail < (uintmax_t)sc->pagesize * MINPAGES)
 		return;
diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index ba41210..ea875e7 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -124,7 +124,7 @@ vwe_eev(struct vwe *vwe, const struct epoll_event *ep, double now)
 				j++;
 				i -= sizeof ss[0];
 			}
-			assert(i == 0);
+			AZ(i);
 		}
 	} else {
 		CAST_OBJ_NOTNULL(sp, ep->data.ptr, SESS_MAGIC);
diff --git a/bin/varnishd/waiter/cache_waiter_kqueue.c b/bin/varnishd/waiter/cache_waiter_kqueue.c
index fb82e99..68f7fba 100644
--- a/bin/varnishd/waiter/cache_waiter_kqueue.c
+++ b/bin/varnishd/waiter/cache_waiter_kqueue.c
@@ -70,7 +70,7 @@ vwk_kq_flush(struct vwk *vwk)
 	if (vwk->nki == 0)
 		return;
 	i = kevent(vwk->kq, vwk->ki, vwk->nki, NULL, 0, NULL);
-	assert(i == 0);
+	AZ(i);
 	vwk->nki = 0;
 }
 
@@ -108,7 +108,7 @@ vwk_pipe_ev(struct vwk *vwk, const struct kevent *kp)
 		j++;
 		i -= sizeof ss[0];
 	}
-	assert(i == 0);
+	AZ(i);
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/waiter/cache_waiter_poll.c b/bin/varnishd/waiter/cache_waiter_poll.c
index d2c29d1..de8fd58 100644
--- a/bin/varnishd/waiter/cache_waiter_poll.c
+++ b/bin/varnishd/waiter/cache_waiter_poll.c
@@ -94,8 +94,8 @@ vwp_poll(struct vwp *vwp, int fd)
 		vwp->hpoll = fd;
 
 	assert(vwp->pollfd[fd].fd == -1);
-	assert(vwp->pollfd[fd].events == 0);
-	assert(vwp->pollfd[fd].revents == 0);
+	AZ(vwp->pollfd[fd].events);
+	AZ(vwp->pollfd[fd].revents);
 
 	vwp->pollfd[fd].fd = fd;
 	vwp->pollfd[fd].events = POLLIN;
@@ -111,7 +111,7 @@ vwp_unpoll(struct vwp *vwp, int fd)
 
 	assert(vwp->pollfd[fd].fd == fd);
 	assert(vwp->pollfd[fd].events == POLLIN);
-	assert(vwp->pollfd[fd].revents == 0);
+	AZ(vwp->pollfd[fd].revents);
 
 	vwp->pollfd[fd].fd = -1;
 	vwp->pollfd[fd].events = 0;
@@ -177,7 +177,7 @@ vwp_main(void *priv)
 			v2--;
 			i = read(vwp->pipes[0], ss, sizeof ss);
 			assert(i >= 0);
-			assert(((unsigned)i % sizeof ss[0]) == 0);
+			AZ((unsigned)i % sizeof ss[0]);
 			for (j = 0; j * sizeof ss[0] < i; j++) {
 				CHECK_OBJ_NOTNULL(ss[j], SESS_MAGIC);
 				assert(ss[j]->fd >= 0);
@@ -185,7 +185,7 @@ vwp_main(void *priv)
 				vwp_poll(vwp, ss[j]->fd);
 			}
 		}
-		assert(v2 == 0);
+		AZ(v2);
 	}
 	NEEDLESS_RETURN(NULL);
 }
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index d8f2877..7fc24fe 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -246,7 +246,7 @@ static struct replay_thread *
 thread_get(int fd, void *(*thread_main)(void *))
 {
 
-	assert(fd != 0);
+	AN(fd);
 	if (fd >= nthreads) {
 		struct replay_thread **newthreads = threads;
 		size_t newnthreads = nthreads;
diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index 7b37f0b..6fa7cc7 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -55,7 +55,7 @@ do_xml_cb(void *priv, const struct VSC_point * const pt)
 	(void)priv;
 	if (pt == NULL)
 		return (0);
-	assert(!strcmp(pt->desc->fmt, "uint64_t"));
+	AZ(strcmp(pt->desc->fmt, "uint64_t"));
 	val = *(const volatile uint64_t*)pt->ptr;
 	sec = pt->section;
 
@@ -100,7 +100,7 @@ do_json_cb(void *priv, const struct VSC_point * const pt)
 		return (0);
 
 	jp = priv;
-	assert(!strcmp(pt->desc->fmt, "uint64_t"));
+	AZ(strcmp(pt->desc->fmt, "uint64_t"));
 	val = *(const volatile uint64_t*)pt->ptr;
 	sec = pt->section;
 
@@ -167,7 +167,7 @@ do_once_cb(void *priv, const struct VSC_point * const pt)
 	if (pt == NULL)
 		return (0);
 	op = priv;
-	assert(!strcmp(pt->desc->fmt, "uint64_t"));
+	AZ(strcmp(pt->desc->fmt, "uint64_t"));
 	val = *(const volatile uint64_t*)pt->ptr;
 	sec = pt->section;
 	i = 0;
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 356a92b..373cf09 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -264,7 +264,7 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt)
 
 	CAST_OBJ_NOTNULL(pt_priv, priv, PT_PRIV_MAGIC);
 
-	assert(!strcmp(vpt->desc->fmt, "uint64_t"));
+	AZ(strcmp(vpt->desc->fmt, "uint64_t"));
 	snprintf(buf, sizeof buf, "%s.%s.%s", vpt->section->type,
 	    vpt->section->ident, vpt->desc->name);
 	buf[sizeof buf - 1] = '\0';
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 470c931..a31c83f 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -390,7 +390,7 @@ cmd_varnishtest(CMD_ARGS)
 
 	if (av == NULL)
 		return;
-	assert(!strcmp(av[0], "varnishtest"));
+	AZ(strcmp(av[0], "varnishtest"));
 
 	vtc_log(vl, 1, "TEST %s", av[1]);
 	AZ(av[2]);
@@ -414,7 +414,7 @@ cmd_shell(CMD_ARGS)
 	AZ(av[2]);
 	vtc_dump(vl, 4, "shell", av[1], -1);
 	r = system(av[1]);
-	assert(WEXITSTATUS(r) == 0);
+	AZ(WEXITSTATUS(r));
 }
 
 /**********************************************************************
diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index 7eb430f..a273776 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -217,7 +217,7 @@ cmd_client(CMD_ARGS)
 		return;
 	}
 
-	assert(!strcmp(av[0], "client"));
+	AZ(strcmp(av[0], "client"));
 	av++;
 
 	VTAILQ_FOREACH(c, &clients, list)
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 4388f73..17dba6b 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -225,7 +225,7 @@ cmd_http_expect(CMD_ARGS)
 	(void)cmd;
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
-	assert(!strcmp(av[0], "expect"));
+	AZ(strcmp(av[0], "expect"));
 	av++;
 
 	AN(av[0]);
@@ -298,13 +298,13 @@ http_splitheader(struct http *hp, int req)
 	hh[n++] = p;
 	while (!vct_islws(*p))
 		p++;
-	assert(!vct_iscrlf(p));
+	AZ(vct_iscrlf(p));
 	*p++ = '\0';
 
 	/* URL/STATUS */
 	while (vct_issp(*p))		/* XXX: H space only */
 		p++;
-	assert(!vct_iscrlf(p));
+	AZ(vct_iscrlf(p));
 	hh[n++] = p;
 	while (!vct_islws(*p))
 		p++;
@@ -524,7 +524,7 @@ cmd_http_rxresp(CMD_ARGS)
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
 	ONLY_CLIENT(hp, av);
-	assert(!strcmp(av[0], "rxresp"));
+	AZ(strcmp(av[0], "rxresp"));
 	av++;
 
 	for(; *av != NULL; av++)
@@ -554,7 +554,7 @@ cmd_http_rxresphdrs(CMD_ARGS)
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
 	ONLY_CLIENT(hp, av);
-	assert(!strcmp(av[0], "rxresphdrs"));
+	AZ(strcmp(av[0], "rxresphdrs"));
 	av++;
 
 	for(; *av != NULL; av++)
@@ -767,7 +767,7 @@ cmd_http_txresp(CMD_ARGS)
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
 	ONLY_SERVER(hp, av);
-	assert(!strcmp(av[0], "txresp"));
+	AZ(strcmp(av[0], "txresp"));
 	av++;
 
 	VSB_clear(hp->vsb);
@@ -812,7 +812,7 @@ cmd_http_rxreq(CMD_ARGS)
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
 	ONLY_SERVER(hp, av);
-	assert(!strcmp(av[0], "rxreq"));
+	AZ(strcmp(av[0], "rxreq"));
 	av++;
 
 	for(; *av != NULL; av++)
@@ -832,7 +832,7 @@ cmd_http_rxreqhdrs(CMD_ARGS)
 	(void)cmd;
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
-	assert(!strcmp(av[0], "rxreqhdrs"));
+	AZ(strcmp(av[0], "rxreqhdrs"));
 	av++;
 
 	for(; *av != NULL; av++)
@@ -850,7 +850,7 @@ cmd_http_rxbody(CMD_ARGS)
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
 	ONLY_SERVER(hp, av);
-	assert(!strcmp(av[0], "rxbody"));
+	AZ(strcmp(av[0], "rxbody"));
 	av++;
 
 	for(; *av != NULL; av++)
@@ -895,7 +895,7 @@ cmd_http_txreq(CMD_ARGS)
 	(void)vl;
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
 	ONLY_CLIENT(hp, av);
-	assert(!strcmp(av[0], "txreq"));
+	AZ(strcmp(av[0], "txreq"));
 	av++;
 
 	VSB_clear(hp->vsb);
diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c
index e6adae7..48c8f3d 100644
--- a/bin/varnishtest/vtc_logexp.c
+++ b/bin/varnishtest/vtc_logexp.c
@@ -489,7 +489,7 @@ cmd_logexp(CMD_ARGS)
 		return;
 	}
 
-	assert(!strcmp(av[0], "logexpect"));
+	AZ(strcmp(av[0], "logexpect"));
 	av++;
 
 	VTAILQ_FOREACH(le, &logexps, list) {
diff --git a/bin/varnishtest/vtc_sema.c b/bin/varnishtest/vtc_sema.c
index fd4c561..2ebfdee 100644
--- a/bin/varnishtest/vtc_sema.c
+++ b/bin/varnishtest/vtc_sema.c
@@ -129,7 +129,7 @@ cmd_sema(CMD_ARGS)
 		return;
 	}
 
-	assert(!strcmp(av[0], "sema"));
+	AZ(strcmp(av[0], "sema"));
 	av++;
 
 	AZ(pthread_mutex_lock(&sema_mtx));
diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index eaa680f..86cf293 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -251,7 +251,7 @@ cmd_server(CMD_ARGS)
 		return;
 	}
 
-	assert(!strcmp(av[0], "server"));
+	AZ(strcmp(av[0], "server"));
 	av++;
 
 	VTAILQ_FOREACH(s, &servers, list)
@@ -278,7 +278,7 @@ cmd_server(CMD_ARGS)
 		if (s->run)
 			server_wait(s);
 
-		assert(s->run == 0);
+		AZ(s->run);
 		if (!strcmp(*av, "-repeat")) {
 			s->repeat = atoi(av[1]);
 			av++;
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 19f51dd..14b94be 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -104,7 +104,7 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
 		    cmd, i, retval, r);
 		return ((enum VCLI_status_e)retval);
 	}
-	assert(i == 0);
+	AZ(i);
 	vtc_log(v->vl, 3, "CLI RX  %u", retval);
 	vtc_dump(v->vl, 4, "CLI RX", r, -1);
 	if (repl != NULL)
@@ -402,7 +402,7 @@ varnish_launch(struct varnish *v)
 	v->pid = fork();
 	assert(v->pid >= 0);
 	if (v->pid == 0) {
-		assert(dup2(v->fds[0], 0) == 0);
+		AZ(dup2(v->fds[0], 0));
 		assert(dup2(v->fds[3], 1) == 1);
 		assert(dup2(1, 2) == 2);
 		AZ(close(v->fds[0]));
@@ -754,7 +754,7 @@ do_stat_cb(void *priv, const struct VSC_point * const pt)
 	if (strcmp(pt->desc->name, p))
 		return (0);
 
-	assert(!strcmp(pt->desc->fmt, "uint64_t"));
+	AZ(strcmp(pt->desc->fmt, "uint64_t"));
 	sp->val = *(const volatile uint64_t*)pt->ptr;
 	return (1);
 }
@@ -843,7 +843,7 @@ cmd_varnish(CMD_ARGS)
 		return;
 	}
 
-	assert(!strcmp(av[0], "varnish"));
+	AZ(strcmp(av[0], "varnish"));
 	av++;
 
 	VTAILQ_FOREACH(v, &varnishes, list)
diff --git a/lib/libvarnish/binary_heap.c b/lib/libvarnish/binary_heap.c
index 33616b5..491974b 100644
--- a/lib/libvarnish/binary_heap.c
+++ b/lib/libvarnish/binary_heap.c
@@ -215,7 +215,7 @@ binheap_new(void *priv, binheap_cmp_t *cmp_f, binheap_update_t *update_f)
 
 	bh->page_size = (unsigned)getpagesize() / sizeof (void *);
 	bh->page_mask = bh->page_size - 1;
-	assert(!(bh->page_size & bh->page_mask));	/* power of two */
+	AZ(bh->page_size & bh->page_mask);	/* power of two */
 	for (u = 1; (1U << u) != bh->page_size; u++)
 		;
 	bh->page_shift = u;
@@ -350,7 +350,7 @@ chk(const struct binheap *bh)
 
 	for (u = 2; u < bh->next; u++) {
 		v = parent(bh, u);
-		assert(!bh->cmp(bh->priv, A(bh, u), A(bh, v)));
+		AZ(bh->cmp(bh->priv, A(bh, u), A(bh, v)));
 	}
 }
 #endif
@@ -603,7 +603,7 @@ main(int argc, char **argv)
 			v = random() % N;
 			if (ff[v] != NULL) {
 				CHECK_OBJ_NOTNULL(ff[v], FOO_MAGIC);
-				assert(ff[v]->idx != 0);
+				AN(ff[v]->idx);
 				if (ff[v]->key & 1) {
 					binheap_delete(bh, ff[v]->idx);
 					assert(ff[v]->idx == BINHEAP_NOIDX);
@@ -619,7 +619,7 @@ main(int argc, char **argv)
 				ff[v]->key = random() % R;
 				binheap_insert(bh, ff[v]);
 				CHECK_OBJ_NOTNULL(ff[v], FOO_MAGIC);
-				assert(ff[v]->idx != 0);
+				AN(ff[v]->idx);
 			}
 			if (0)
 				chk2(bh);
diff --git a/lib/libvarnish/cli_serve.c b/lib/libvarnish/cli_serve.c
index 3ea59d6..7b7d9d5 100644
--- a/lib/libvarnish/cli_serve.c
+++ b/lib/libvarnish/cli_serve.c
@@ -369,7 +369,7 @@ cls_vlu(void *priv, const char *p)
 		return (0);
 	} else {
 		AN(cfd->argv[cfd->last_idx]);
-		assert(!strcmp(cfd->argv[cfd->last_idx], "<<"));
+		AZ(strcmp(cfd->argv[cfd->last_idx], "<<"));
 		AN(cfd->argv[cfd->last_idx + 1]);
 		if (strcmp(p, cfd->argv[cfd->last_idx + 1])) {
 			VSB_cat(cfd->last_arg, p);
diff --git a/lib/libvarnish/vav.c b/lib/libvarnish/vav.c
index 24b16b7..715e43c 100644
--- a/lib/libvarnish/vav.c
+++ b/lib/libvarnish/vav.c
@@ -90,7 +90,7 @@ VAV_BackSlash(const char *s, char *res)
 		break;
 	case 'x':
 		if (1 == sscanf(s + 1, "x%02x", &u)) {
-			assert(!(u & ~0xff));
+			AZ(u & ~0xff);
 			c = u;	/*lint !e734 loss of precision */
 			r = 4;
 		}
diff --git a/lib/libvarnish/vev.c b/lib/libvarnish/vev.c
index 87d1582..6429e4b 100644
--- a/lib/libvarnish/vev.c
+++ b/lib/libvarnish/vev.c
@@ -257,7 +257,7 @@ vev_add(struct vev_base *evb, struct vev *e)
 		es = &vev_sigs[e->sig];
 		if (es->vev != NULL)
 			return (EBUSY);
-		assert(es->happened == 0);
+		AZ(es->happened);
 		es->vev = e;
 		es->vevb = evb;
 		es->sigact.sa_flags = e->sig_flags;
@@ -299,7 +299,7 @@ vev_add(struct vev_base *evb, struct vev *e)
 
 	if (e->sig > 0) {
 		assert(es != NULL);
-		assert(sigaction(e->sig, &es->sigact, NULL) == 0);
+		AZ(sigaction(e->sig, &es->sigact, NULL));
 	}
 
 	return (0);
@@ -320,7 +320,7 @@ vev_del(struct vev_base *evb, struct vev *e)
 
 	if (e->__binheap_idx != 0)
 		binheap_delete(evb->binheap, e->__binheap_idx);
-	assert(e->__binheap_idx == 0);
+	AZ(e->__binheap_idx);
 
 	if (e->fd >= 0) {
 		DBG(evb, "... pidx = %d\n", e->__poll_idx);
@@ -341,7 +341,7 @@ vev_del(struct vev_base *evb, struct vev *e)
 		es->vevb = NULL;
 		es->sigact.sa_flags = e->sig_flags;
 		es->sigact.sa_handler = SIG_DFL;
-		assert(sigaction(e->sig, &es->sigact, NULL) == 0);
+		AZ(sigaction(e->sig, &es->sigact, NULL));
 		es->happened = 0;
 	}
 
@@ -517,6 +517,6 @@ vev_schedule_one(struct vev_base *evb)
 			free(e);
 		}
 	}
-	assert(i == 0);
+	AZ(i);
 	return (1);
 }
diff --git a/lib/libvarnish/vfil.c b/lib/libvarnish/vfil.c
index 5a5f087..920a06f 100644
--- a/lib/libvarnish/vfil.c
+++ b/lib/libvarnish/vfil.c
@@ -87,7 +87,7 @@ VFIL_readfd(int fd, ssize_t *sz)
 	char *f;
 	int i;
 
-	assert(0 == fstat(fd, &st));
+	AZ(fstat(fd, &st));
 	if (!S_ISREG(st.st_mode))
 		return (NULL);
 	f = malloc(st.st_size + 1);
diff --git a/lib/libvarnish/vsha256.c b/lib/libvarnish/vsha256.c
index a2208cf..6642d9f 100644
--- a/lib/libvarnish/vsha256.c
+++ b/lib/libvarnish/vsha256.c
@@ -329,6 +329,6 @@ SHA256_Test(void)
 		SHA256_Init(&c);
 		SHA256_Update(&c, p->input, strlen(p->input));
 		SHA256_Final(o, &c);
-		assert(!memcmp(o, p->output, 32));
+		AZ(memcmp(o, p->output, 32));
 	}
 }
diff --git a/lib/libvarnish/vtim.c b/lib/libvarnish/vtim.c
index 42c1558..c0efdbd 100644
--- a/lib/libvarnish/vtim.c
+++ b/lib/libvarnish/vtim.c
@@ -73,12 +73,12 @@ VTIM_mono(void)
 #elif  HAVE_CLOCK_GETTIME
 	struct timespec ts;
 
-	assert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
+	AZ(clock_gettime(CLOCK_MONOTONIC, &ts));
 	return (ts.tv_sec + 1e-9 * ts.tv_nsec);
 #else
 	struct timeval tv;
 
-	assert(gettimeofday(&tv, NULL) == 0);
+	AZ(gettimeofday(&tv, NULL));
 	return (tv.tv_sec + 1e-6 * tv.tv_usec);
 #endif
 }
@@ -89,12 +89,12 @@ VTIM_real(void)
 #ifdef HAVE_CLOCK_GETTIME
 	struct timespec ts;
 
-	assert(clock_gettime(CLOCK_REALTIME, &ts) == 0);
+	AZ(clock_gettime(CLOCK_REALTIME, &ts));
 	return (ts.tv_sec + 1e-9 * ts.tv_nsec);
 #else
 	struct timeval tv;
 
-	assert(gettimeofday(&tv, NULL) == 0);
+	AZ(gettimeofday(&tv, NULL));
 	return (tv.tv_sec + 1e-6 * tv.tv_usec);
 #endif
 }
@@ -150,7 +150,7 @@ VTIM_parse(const char *p)
 			 * to set the timezone to UTC.  We check that.
 			 */
 			t = mktime(&tm);
-			assert(!strcmp(tzname[0], "UTC"));
+			AZ(strcmp(tzname[0], "UTC"));
 #endif
 			return (t);
 		}
diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c
index 0ab3f64..89e63b0 100644
--- a/lib/libvcc/vcc_storage.c
+++ b/lib/libvcc/vcc_storage.c
@@ -109,7 +109,7 @@ vcc_Stv_Wildcard(struct vcc *tl, const struct token *t,
 
 	(void)wcsym;
 	assert((t->e - t->b) > strlen(PFX));
-	assert(!memcmp(t->b, PFX, strlen(PFX)));
+	AZ(memcmp(t->b, PFX, strlen(PFX)));
 
 	p = t->b + strlen(PFX);
 	for (q = p; q < t->e && *q != '.'; q++)



More information about the varnish-commit mailing list