r914 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Aug 24 09:57:08 CEST 2006


Author: phk
Date: 2006-08-24 09:57:07 +0200 (Thu, 24 Aug 2006)
New Revision: 914

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
   trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_ban.c
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_cli.c
   trunk/varnish-cache/bin/varnishd/cache_expire.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/cache_pass.c
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
   trunk/varnish-cache/bin/varnishd/cache_response.c
   trunk/varnish-cache/bin/varnishd/cache_session.c
   trunk/varnish-cache/bin/varnishd/cache_vcl.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
   trunk/varnish-cache/bin/varnishd/cache_vrt_re.c
   trunk/varnish-cache/bin/varnishd/flint.lnt
   trunk/varnish-cache/bin/varnishd/hash_classic.c
   trunk/varnish-cache/bin/varnishd/hash_simple_list.c
   trunk/varnish-cache/bin/varnishd/mgt_child.c
   trunk/varnish-cache/bin/varnishd/mgt_cli.c
   trunk/varnish-cache/bin/varnishd/mgt_param.c
   trunk/varnish-cache/bin/varnishd/mgt_vcc.c
   trunk/varnish-cache/bin/varnishd/shmlog.c
   trunk/varnish-cache/bin/varnishd/storage_file.c
   trunk/varnish-cache/bin/varnishd/storage_malloc.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Go through all asserts and mark those which indicate missing code with
xxx or XXX.



Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -63,7 +63,7 @@
 		return (NULL);
 	}
 	sp = SES_New(addr, l);
-	assert(sp != NULL);	/* XXX handle */
+	XXXAN(sp);
 
 	(void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
 	sp->fd = i;
@@ -156,8 +156,8 @@
 {
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	assert(sp->obj == NULL);
-	assert(sp->vcl == NULL);
+	AZ(sp->obj);
+	AZ(sp->vcl);
 	if (sp->fd >= 0) {
 		VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port);
 		(void)clock_gettime(CLOCK_REALTIME, &sp->t_open);

Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -32,14 +32,12 @@
 vca_kq_sess(struct sess *sp, int arm)
 {
 	struct kevent ke;
-	int i;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	if (sp->fd < 0)
 		return;
 	EV_SET(&ke, sp->fd, EVFILT_READ, arm, 0, 0, sp);
-	i = kevent(kq, &ke, 1, NULL, 0, NULL);
-	assert(i == 0);
+	AZ(kevent(kq, &ke, 1, NULL, 0, NULL));
 }
 
 static void
@@ -48,7 +46,7 @@
 	int i;
 	struct sess *sp;
 
-	assert(kp->udata != NULL);
+	AN(kp->udata);
 	if (kp->udata == pipes) {
 		while (kp->data > 0) {
 			i = read(pipes[0], &sp, sizeof sp);
@@ -89,7 +87,7 @@
 vca_kqueue_main(void *arg)
 {
 	struct kevent ke[NKEV], *kp;
-	int i, j, n;
+	int j, n;
 	struct timespec ts;
 	struct sess *sp;
 
@@ -101,8 +99,7 @@
 	j = 0;
 	EV_SET(&ke[j++], 0, EVFILT_TIMER, EV_ADD, 0, 100, NULL);
 	EV_SET(&ke[j++], pipes[0], EVFILT_READ, EV_ADD, 0, 0, pipes);
-	i = kevent(kq, ke, j, NULL, 0, NULL);
-	assert(i == 0);
+	AZ(kevent(kq, ke, j, NULL, 0, NULL));
 
 	while (1) {
 		n = kevent(kq, NULL, 0, ke, NKEV, NULL);

Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -44,7 +44,7 @@
 		u += u;
 	VSL(SLT_Debug, 0, "Acceptor Pollspace %u", u);
 	p = realloc(pollfd, u * sizeof *p);
-	assert(p != NULL);
+	XXXAN(p);	/* close offending fd */
 	memset(p + npoll, 0, (u - npoll) * sizeof *p);
 	for (v = npoll ; v <= u; v++) 
 		p->fd = -1;

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -151,8 +151,8 @@
 	char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE];
 	struct addrinfo *ai;
 
-	assert(bp != NULL);
-	assert(bp->hostname != NULL);
+	CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC);
+	AN(bp->hostname);
 
 	s = vbe_conn_try(bp, &ai);
 	if (s < 0) 
@@ -217,14 +217,14 @@
 			vc = vbe_new_conn();
 		else
 			vc = vc2;
-		assert(vc != NULL);
+		AN(vc);
 		assert(vc->fd == -1);
-		assert(vc->backend == NULL);
+		AZ(vc->backend);
 	}
 
 	/* If not connected yet, do so */
 	if (vc->fd < 0) {
-		assert(vc->backend == NULL);
+		AZ(vc->backend);
 		vc->fd = vbe_connect(bp);
 		LOCK(&vbemtx);
 		if (vc->fd < 0) {
@@ -244,7 +244,7 @@
 		assert(vc->fd >= 0);
 		VSL_stats->backend_conn++;
 		VSL(SLT_BackendXID, vc->fd, "%u", xid);
-		assert(vc->backend != NULL);
+		AN(vc->backend);
 	}
 	return (vc);
 }
@@ -257,7 +257,7 @@
 
 	CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC);
 	assert(vc->fd >= 0);
-	assert(vc->backend != NULL);
+	AN(vc->backend);
 	VSL(SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name);
 	if (!already)
 		AZ(close(vc->fd));
@@ -277,7 +277,7 @@
 
 	CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC);
 	assert(vc->fd >= 0);
-	assert(vc->backend != NULL);
+	AN(vc->backend);
 	VSL_stats->backend_recycle++;
 	VSL(SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name);
 	LOCK(&vbemtx);

Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ban.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_ban.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -30,7 +30,7 @@
 	int i;
 
 	b = calloc(sizeof *b, 1);
-	assert(b != NULL);
+	XXXAN(b);
 
 	i = regcomp(&b->regexp, regexp, REG_EXTENDED | REG_NOSUB);
 	if (i) {

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -95,8 +95,8 @@
 	double dh, dp, da;
 	struct timespec te;
 
-	assert(sp->obj == NULL);
-	assert(sp->vbc == NULL);
+	AZ(sp->obj);
+	AZ(sp->vbc);
 	if (sp->fd >= 0 && sp->doclose != NULL)
 		vca_close_session(sp, sp->doclose);
 	sp->backend = NULL;
@@ -194,7 +194,7 @@
 cnt_fetch(struct sess *sp)
 {
 
-	assert(sp->vbc != NULL);
+	CHECK_OBJ_NOTNULL(sp->vbc, VBE_CONN_MAGIC);
 	RFC2616_cache_policy(sp, sp->vbc->http);
 
 	VCL_fetch_method(sp);
@@ -220,9 +220,8 @@
 	}
 	if (sp->handling == VCL_RET_INSERT) {
 		sp->obj->cacheable = 1;
-		assert(sp->vbc != NULL);
 		FetchBody(sp);
-		assert(sp->vbc == NULL);
+		AZ(sp->vbc);
 		HSH_Ref(sp->obj); /* get another, STP_DELIVER will deref */
 		HSH_Unbusy(sp->obj);
 		sp->wrk->acct.fetch++;
@@ -362,7 +361,7 @@
 cnt_lookup(struct sess *sp)
 {
 
-	assert(sp->obj == NULL);
+	AZ(sp->obj);
 	sp->step = STP_LOOKUP2;
 	return (0);
 }
@@ -469,10 +468,10 @@
 	if (sp->handling == VCL_RET_LOOKUP)
 		INCOMPL();
 	if (sp->handling == VCL_RET_FETCH) {
-		assert(sp->vbc == NULL);
+		AZ(sp->vbc);
 		FetchHeaders(sp);
 		sp->step = STP_FETCH;
-		assert(sp->vbc != NULL);
+		AN(sp->vbc);
 		return (0);
 	}
 	INCOMPL();
@@ -497,9 +496,9 @@
 cnt_pass(struct sess *sp)
 {
 
-	assert(sp->vbc == NULL);
+	AZ(sp->vbc);
 	if (!PassSession(sp)) {
-		assert(sp->vbc != NULL);
+		AN(sp->vbc);
 		sp->step = STP_PASSBODY;
 	} else 
 		sp->step = STP_DONE;
@@ -526,9 +525,9 @@
 {
 
 	sp->wrk->acct.pass++;
-	assert(sp->vbc != NULL);
+	AN(sp->vbc);
 	PassBody(sp);
-	assert(sp->vbc == NULL);
+	AZ(sp->vbc);
 	sp->step = STP_DONE;
 	return (0);
 }
@@ -591,11 +590,11 @@
 	int done;
 
 	sp->t0 = time(NULL);
-	assert(sp->vcl == NULL);
+	AZ(sp->vcl);
 	sp->vcl = VCL_Get();
 
-	assert(sp->obj == NULL);
-	assert(sp->vbc == NULL);
+	AZ(sp->obj);
+	AZ(sp->vbc);
 
 	sp->wrk->acct.req++;
 	done = http_DissectRequest(sp->http, sp->fd);

Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_cli.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_cli.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -65,10 +65,10 @@
 	memset(cli, 0, sizeof *cli);
 	
 	cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-	assert(cli->sb != NULL);
+	XXXAN(cli->sb);
 	lbuf = 4096;
 	buf = malloc(lbuf);
-	assert(buf != NULL);
+	XXXAN(buf);
 	nbuf = 0;
 	while (1) {
 		pfd[0].fd = heritage.fds[2];
@@ -79,7 +79,7 @@
 		if ((nbuf + 2) >= lbuf) {
 			lbuf += lbuf;
 			buf = realloc(buf, lbuf);
-			assert(buf != NULL);
+			XXXAN(buf);
 		}
 		i = read(heritage.fds[2], buf + nbuf, lbuf - nbuf);
 		if (i <= 0) {

Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -110,7 +110,7 @@
 	(void)arg;
 
 	sp = SES_New(NULL, 0);
-	assert(sp != NULL);
+	XXXAN(sp);
 	while (1) {
 		t = time(NULL);
 		LOCK(&exp_mtx);
@@ -179,7 +179,7 @@
 
 	AZ(pthread_mutex_init(&exp_mtx, NULL));
 	exp_heap = binheap_new(NULL, object_cmp, object_update);
-	assert(exp_heap != NULL);
+	XXXAN(exp_heap);
 	AZ(pthread_create(&exp_thread, NULL, exp_prefetch, NULL));
 	AZ(pthread_create(&exp_thread, NULL, exp_hangman, NULL));
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -40,7 +40,7 @@
 	cl = strtoumax(b, NULL, 0);
 
 	st = stevedore->alloc(stevedore, cl);
-	assert(st->stevedore != NULL);
+	XXXAN(st->stevedore);
 	TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
 	st->len = cl;
 	sp->obj->len = cl;
@@ -52,7 +52,7 @@
 
 	while (cl > 0) {
 		i = http_Read(hp, fd, p, cl);
-		assert(i > 0);	/* XXX seen */
+		xxxassert(i > 0);	/* XXX seen */
 		p += i;
 		cl -= i;
 	}
@@ -82,18 +82,18 @@
 	st = NULL;
 	while (1) {
 		i = http_Read(hp, fd, bp, be - bp);
-		assert(i >= 0);
+		xxxassert(i >= 0);
 		bp += i;
 		*bp = '\0';
 		u = strtoul(buf, &q, 16);
 		if (q == NULL || q == buf)
 			continue;
-		assert(isspace(*q));
+		xxxassert(isspace(*q));
 		while (*q == '\t' || *q == ' ')
 			q++;
 		if (*q == '\r')
 			q++;
-		assert(*q == '\n');
+		xxxassert(*q == '\n');
 		q++;
 		if (u == 0)
 			break;
@@ -105,7 +105,7 @@
 			} else {
 				st = stevedore->alloc(stevedore,
 				    stevedore->trim == NULL ? u : CHUNK_PREALLOC);
-				assert(st->stevedore != NULL);
+				XXXAN(st->stevedore);
 				TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
 				p = st->ptr;
 			}
@@ -114,9 +114,9 @@
 				v = u;
 
 			i = bp - q;
+			assert(i >= 0);
 			if (i == 0) {
 			} else if (v > i) {
-				assert(i > 0);
 				memcpy(p, q, i);
 				p += i;
 				st->len += i;
@@ -141,7 +141,6 @@
 				continue;
 			while (v > 0) {
 				i = http_Read(hp, fd, p, v);
-				assert(i > 0);
 				st->len += i;
 				v -= i;
 				u -= i;
@@ -178,15 +177,15 @@
 	while (1) {
 		if (v == 0) {
 			st = stevedore->alloc(stevedore, CHUNK_PREALLOC);
-			assert(st->stevedore != NULL);
+			XXXAN(st->stevedore);
 			TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
 			p = st->ptr + st->len;
 			v = st->space - st->len;
 		}
-		assert(p != NULL);
-		assert(st != NULL);
+		AN(p);
+		AN(st);
 		i = http_Read(hp, fd, p, v);
-		assert(i >= 0);
+		xxxassert(i >= 0);
 		if (i == 0)
 		     break;
 		p += i;
@@ -286,7 +285,7 @@
 	vc = VBE_GetFd(sp->backend, sp->xid);
 	if (vc == NULL)
 		vc = VBE_GetFd(sp->backend, sp->xid);
-	assert(vc != NULL);	/* XXX: handle this */
+	XXXAN(vc);
 	VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
 	http_ClrHeader(vc->http);
@@ -302,19 +301,19 @@
 	WRK_Reset(w, &vc->fd);
 	http_Write(w, vc->http, 0);
 	i = WRK_Flush(w);
-	assert(i == 0);
+	xxxassert(i == 0);
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
 
 	i = http_RecvHead(vc->http, vc->fd);
-	assert(i == 0);
-	assert(http_DissectResponse(vc->http, vc->fd) == 0);
+	xxxassert(i == 0);
+	xxxassert(http_DissectResponse(vc->http, vc->fd) == 0);
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
-	assert(sp->vbc == NULL);
+	AZ(sp->vbc);
 	sp->vbc = vc;
 
 	sp->obj->entered = time(NULL);

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -50,14 +50,14 @@
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC);
-	assert(hash != NULL);
+	AN(hash);
 	w = sp->wrk;
 	h = sp->http;
 
 	/* Precreate an objhead and object in case we need them */
 	if (w->nobjhead == NULL) {
 		w->nobjhead = calloc(sizeof *w->nobjhead, 1);
-		assert(w->nobjhead != NULL);
+		XXXAN(w->nobjhead);
 		w->nobjhead->magic = OBJHEAD_MAGIC;
 		TAILQ_INIT(&w->nobjhead->objects);
 		AZ(pthread_mutex_init(&w->nobjhead->mtx, NULL));
@@ -66,7 +66,7 @@
 		CHECK_OBJ_NOTNULL(w->nobjhead, OBJHEAD_MAGIC);
 	if (w->nobj == NULL) {
 		w->nobj = calloc(sizeof *w->nobj, 1);
-		assert(w->nobj != NULL);
+		XXXAN(w->nobj);
 		w->nobj->magic = OBJECT_MAGIC;
 		w->nobj->http.magic = HTTP_MAGIC;
 		w->nobj->busy = 1;
@@ -139,7 +139,7 @@
 {
 	struct sess *sp;
 
-	assert(o != NULL);
+	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
 	assert(o->busy);
 	assert(o->refcnt > 0);
 	if (o->cacheable)

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -87,9 +87,9 @@
 {
 	unsigned l;
 
-	assert(hh->b != NULL);
-	assert(hh->e != NULL);
-	assert(hdr != NULL);
+	AN(hh->b);
+	AN(hh->e);
+	AN(hdr);
 	l = hdr[0];
 	assert(l == strlen(hdr + 1));
 	assert(hdr[l] == ':');
@@ -105,8 +105,8 @@
 	unsigned u;
 
 	for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
-		assert(hp->hd[u].b != NULL);
-		assert(hp->hd[u].e != NULL);
+		AN(hp->hd[u].b);
+		AN(hp->hd[u].e);
 		if (hp->hd[u].e < hp->hd[u].b + l + 1)
 			continue;
 		if (hp->hd[u].b[l] != ':')
@@ -221,7 +221,7 @@
 
 	if (!http_GetHdr(hp, hdr, &p))
 		return (0);
-	assert(p != NULL);
+	AN(p);
 	if (!strcasecmp(p, val))
 		return (1);
 	return (0);
@@ -285,7 +285,7 @@
 http_GetStatus(struct http *hp)
 {
 
-	assert(hp->hd[HTTP_HDR_STATUS].b != NULL);
+	AN(hp->hd[HTTP_HDR_STATUS].b);
 	return (strtoul(hp->hd[HTTP_HDR_STATUS].b,
 	    NULL /* XXX */, 10));
 }
@@ -346,7 +346,8 @@
 {
 	char *p;
 
-	assert(hp->t != NULL);
+	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
+	AN(hp->t);
 	assert(hp->s < hp->t);
 	assert(hp->t <= hp->v);
 	hp->logtag = HTTP_Rx;
@@ -412,7 +413,8 @@
 {
 	char *p, *q;
 
-	assert(hp->t != NULL);
+	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
+	AN(hp->t);
 	assert(hp->s < hp->t);
 	assert(hp->t <= hp->v);
 	hp->logtag = HTTP_Rx;
@@ -462,6 +464,7 @@
 {
 	char *p;
 
+	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 	assert(hp->v <= hp->e);
 	assert(*hp->v == '\0');
 	/* Skip any leading white space */
@@ -595,17 +598,17 @@
 	for (u = 0; u < fm->nhd; u++) {
 		if (fm->hd[u].b == NULL)
 			continue;
-		assert(fm->hd[u].e != NULL);
+		AN(fm->hd[u].e);
 		l += (fm->hd[u].e - fm->hd[u].b) + 1;
 	}
 	to->s = malloc(l);
-	assert(to->s != NULL);
+	XXXAN(to->s);
 	to->e = to->s + l;
 	to->f = to->s;
 	for (u = 0; u < fm->nhd; u++) {
 		if (fm->hd[u].b == NULL)
 			continue;
-		assert(fm->hd[u].e != NULL);
+		AN(fm->hd[u].e);
 		assert(*fm->hd[u].e == '\0');
 		l = fm->hd[u].e - fm->hd[u].b;
 		assert(l == strlen(fm->hd[u].b));
@@ -623,8 +626,9 @@
 static void
 http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm)
 {
+
 	assert(n < HTTP_HDR_MAX);
-	assert(fm != NULL);
+	AN(fm);
 	to->hd[n].b = (void*)(uintptr_t)fm;
 	to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0');
 	to->hdf[n] = 0;
@@ -636,7 +640,7 @@
 {
 
 	assert(n < HTTP_HDR_MAX);
-	assert(fm->hd[n].b != NULL);
+	AN(fm->hd[n].b);
 	to->hd[n].b = fm->hd[n].b;
 	to->hd[n].e = fm->hd[n].e;
 	to->hdf[n] = fm->hdf[n];
@@ -693,7 +697,7 @@
 	CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
 	CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
 	assert(n < HTTP_HDR_MAX);
-	assert(fm->hd[n].b != NULL);
+	AN(fm->hd[n].b);
 	if (to->nhd < HTTP_HDR_MAX) {
 		to->hd[to->nhd].b = fm->hd[n].b;
 		to->hd[to->nhd].e = fm->hd[n].e;
@@ -788,19 +792,19 @@
 	unsigned u, l;
 
 	if (resp) {
-		assert(hp->hd[HTTP_HDR_STATUS].b != NULL);
+		AN(hp->hd[HTTP_HDR_STATUS].b);
 		l = WRK_WriteH(w, &hp->hd[HTTP_HDR_PROTO], " ");
 		l += WRK_WriteH(w, &hp->hd[HTTP_HDR_STATUS], " ");
 		l += WRK_WriteH(w, &hp->hd[HTTP_HDR_RESPONSE], "\r\n");
 	} else {
-		assert(hp->hd[HTTP_HDR_URL].b != NULL);
+		AN(hp->hd[HTTP_HDR_URL].b);
 		l = WRK_WriteH(w, &hp->hd[HTTP_HDR_REQ], " ");
 		l += WRK_WriteH(w, &hp->hd[HTTP_HDR_URL], " ");
 		l += WRK_WriteH(w, &hp->hd[HTTP_HDR_PROTO], "\r\n");
 	}
 	for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
-		assert(hp->hd[u].b != NULL);
-		assert(hp->hd[u].e != NULL);
+		AN(hp->hd[u].b);
+		AN(hp->hd[u].e);
 		l += WRK_WriteH(w, &hp->hd[u], "\r\n");
 	}
 	l += WRK_Write(w, "\r\n", -1);

Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pass.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_pass.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -49,7 +49,6 @@
 			vca_close_session(sp, "backend closed");
 			return (1);
 		}
-		assert(i > 0);
 		sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, buf, i);
 		if (WRK_Flush(sp->wrk))
 			vca_close_session(sp, "remote closed");
@@ -79,7 +78,7 @@
 	p = buf;
 	while (1) {
 		i = http_Read(hp, fd, bp, be - bp);
-		assert(i >= 0);
+		xxxassert(i >= 0);
 		if (i == 0 && p == bp)
 			break;
 		bp += i;
@@ -131,7 +130,7 @@
 			if (j > be - bp)
 				j = be - bp;
 			i = http_Read(hp, fd, bp, j);
-			assert(i > 0);
+			xxxassert(i > 0);
 			bp += i;
 		}
 	}
@@ -150,8 +149,9 @@
 	char *b;
 	int cls;
 
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->vbc, VBE_CONN_MAGIC);
 	vc = sp->vbc;
-	assert(vc != NULL);
 	sp->vbc = NULL;
 
 	clock_gettime(CLOCK_REALTIME, &sp->t_resp);
@@ -207,7 +207,6 @@
 		RES_Error(sp, 503, "Backend did not respond.");
 		return (1);
 	}
-	assert(vc != NULL);
 	VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
 	http_CopyReq(vc->fd, vc->http, sp->http);
@@ -216,12 +215,12 @@
 	WRK_Reset(w, &vc->fd);
 	http_Write(w, vc->http, 0);
 	i = WRK_Flush(w);
-	assert(i == 0);
+	xxxassert(i == 0);
 
 	/* XXX: copy any contents */
 
 	i = http_RecvHead(vc->http, vc->fd);
-	assert(i == 0);
+	xxxassert(i == 0);
 	http_DissectResponse(vc->http, vc->fd);
 
 	assert(sp->vbc == NULL);

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -58,7 +58,6 @@
 		RES_Error(sp, 503, "Backend did not respond.");
 		return;
 	}
-	assert(vc != NULL);
 	VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 	vc->http->logtag = HTTP_Tx;
 

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -69,10 +69,10 @@
 	unsigned u;
 	
 	CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
-	assert(w != NULL);
-	assert(hh != NULL);
-	assert(hh->b != NULL);
-	assert(hh->e != NULL);
+	AN(w);
+	AN(hh);
+	AN(hh->b);
+	AN(hh->e);
 	u = WRK_Write(w, hh->b, hh->e - hh->b);
 	if (suf != NULL)
 		u += WRK_Write(w, suf, -1);
@@ -128,7 +128,7 @@
 	struct workreq *wrq;
 
 	wrq = TAILQ_FIRST(&wrk_reqhead);
-	assert(wrq != NULL);
+	AN(wrq);
 	VSL_stats->n_wrk_busy++;
 	TAILQ_REMOVE(&wrk_reqhead, wrq, list);
 	VSL_stats->n_wrk_queue--;

Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -82,7 +82,7 @@
 		}
 
 	sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-	assert(sb != NULL);
+	XXXAN(sb);
 	assert(code >= 100 && code <= 999);
 
 	if (msg == NULL) {
@@ -226,7 +226,7 @@
 		TAILQ_FOREACH(st, &sp->obj->store, list) {
 			CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 			CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
-			assert(st->stevedore != NULL);
+			AN(st->stevedore);
 			u += st->len;
 			sp->wrk->acct.bodybytes += st->len;
 #ifdef HAVE_SENDFILE

Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -72,7 +72,7 @@
 	struct srcaddrhead *ch;
 	time_t now;
 
-	assert(sp->srcaddr == NULL);
+	AZ(sp->srcaddr);
 	for (u = 0, p = sp->addr; *p; p++)
 		u += u + *p;
 	v = u % CLIENT_HASH;
@@ -110,12 +110,12 @@
 	}
 	if (c3 == NULL) {
 		c3 = malloc(sizeof *c3);
-		assert(c3 != NULL);
+		XXXAN(c3);
 		if (c3 != NULL)
 			VSL_stats->n_srcaddr++;
 	} else
 		TAILQ_REMOVE(ch, c3, list);
-	assert (c3 != NULL);
+	AN(c3);
 	if (c3 != NULL) {
 		memset(c3, 0, sizeof *c3);
 		strcpy(c3->addr, sp->addr);
@@ -177,7 +177,7 @@
 		/* If we never get to work pool (illegal req) */
 		return;
 	}
-	assert(sp->srcaddr != NULL);
+	AN(sp->srcaddr);
 	LOCK(&ses_mtx);
 	assert(sp->srcaddr->nref > 0);
 	sp->srcaddr->nref--;
@@ -236,7 +236,7 @@
 	sm->sess.http = &sm->http;
 
 	sm->sess.sockaddr = sm->sockaddr;
-	assert(len  < sizeof(sm->sockaddr));
+	assert(len < sizeof(sm->sockaddr));
 	if (addr != NULL) {
 		memcpy(sm->sess.sockaddr, addr, len);
 		sm->sess.sockaddrlen = len;
@@ -259,8 +259,8 @@
 	sm = sp->mem;
 	CHECK_OBJ_NOTNULL(sm, SESSMEM_MAGIC);
 	
-	assert(sp->obj == NULL);
-	assert(sp->vcl == NULL);
+	AZ(sp->obj);
+	AZ(sp->vcl);
 	VSL_stats->n_sess--;
 	ses_relsrcaddr(sp);
 	VSL(SLT_StatSess, sp->id, "%s %s %d %ju %ju %ju %ju %ju %ju %ju",

Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vcl.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_vcl.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -47,9 +47,9 @@
 	struct VCL_conf *vc;
 
 	LOCK(&vcl_mtx);
-	assert(vcl_active != NULL);
+	AN(vcl_active);
 	vc = vcl_active->conf;
-	assert(vc != NULL);
+	AN(vc);
 	vc->busy++;
 	UNLOCK(&vcl_mtx);
 	return (vc);
@@ -106,7 +106,7 @@
 	}
 
 	vcl = calloc(sizeof *vcl, 1);
-	assert(vcl != NULL);
+	XXXAN(vcl);
 
 	vcl->dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL);
 
@@ -140,7 +140,7 @@
 	}
 	vcl->conf->priv = vcl;
 	vcl->name = strdup(name);
-	assert(vcl->name != NULL);
+	XXXAN(vcl->name);
 	TAILQ_INSERT_TAIL(&vcl_head, vcl, list);
 	LOCK(&vcl_mtx);
 	if (vcl_active == NULL)

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -47,8 +47,7 @@
 	char *p;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	assert(sp != NULL);
-	assert(sp->http != NULL);
+	AN(sp->http);
 	if (!http_GetHdr(sp->http, n, &p))
 		return (NULL);
 	return (p);
@@ -80,10 +79,10 @@
 	int i;
 
 	cp->backend = calloc(sizeof *cp->backend, cp->nbackend);
-	assert(cp->backend != NULL);
+	XXXAN(cp->backend);
 	for (i = 0; i < cp->nbackend; i++) {
 		cp->backend[i] = calloc(sizeof *cp->backend[i], 1);
-		assert(cp->backend[i] != NULL);
+		XXXAN(cp->backend[i]);
 		cp->backend[i]->magic = BACKEND_MAGIC;
 		TAILQ_INIT(&cp->backend[i]->connlist);
 	}

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -34,7 +34,7 @@
 vrt_acl_vsl(struct sess *sp, const char *acl, struct vrt_acl *ap, int r)
 {
 
-	assert(ap != NULL);
+	AN(ap);
 	if (ap->name == NULL) {
 		assert(r == 0);
 		VSL(SLT_VCL_acl, sp->fd, "NO_MATCH %s", acl);

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -20,12 +20,11 @@
 VRT_re_init(void **rep, const char *re)
 {
 	regex_t	*t;
-	int i;
 
 	t = calloc(sizeof *t, 1);
-	assert(t != NULL);
-	i = regcomp(t, re, REG_EXTENDED | REG_NOSUB);
-	assert(i == 0);
+	XXXAN(t);
+	/* This was already check-compiled by the VCL compiler */
+	AZ(regcomp(t, re, REG_EXTENDED | REG_NOSUB));
 	*rep = t;
 }
 
@@ -45,7 +44,7 @@
 
 	if (s == NULL)
 		return (0);
-	assert(re != NULL);
+	AN(re);
 	t = re;
 	i = regexec(t, s, 0, NULL, 0);
 	if (i == 0)

Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt	2006-08-24 07:57:07 UTC (rev 914)
@@ -8,6 +8,7 @@
 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
 
 -sem(lbv_assert, r_no)
+-sem(lbv_xxxassert, r_no)
 
 -ffc	// No automatic custody
 

Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_classic.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/hash_classic.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -142,7 +142,7 @@
 	unsigned u;
 
 	hcl_head = calloc(sizeof *hcl_head, hcl_nhash);
-	assert(hcl_head != NULL);
+	XXXAN(hcl_head);
 
 	for (u = 0; u < hcl_nhash; u++) {
 		TAILQ_INIT(&hcl_head[u].head);
@@ -220,7 +220,7 @@
 
 		i = sizeof *he2 + kl;
 		he2 = calloc(i, 1);
-		assert(he2 != NULL);
+		XXXAN(he2);
 		he2->magic = HCL_ENTRY_MAGIC;
 		he2->oh = noh;
 		he2->digest = digest;

Modified: trunk/varnish-cache/bin/varnishd/hash_simple_list.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_simple_list.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/hash_simple_list.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -71,13 +71,13 @@
 		return (NULL);
 	}
 	he2 = calloc(sizeof *he2, 1);
-	assert(he2 != NULL);
+	XXXAN(he2);
 	he2->obj = nobj;
 	he2->refcnt = 1;
 	he2->key1 = strdup(key1);
-	assert(he2->key1 != NULL);
+	XXXAN(he2->key1);
 	he2->key2 = strdup(key2);
-	assert(he2->key2 != NULL);
+	XXXAN(he2->key2);
 	nobj->hashpriv = he2;
 	if (he != NULL)
 		TAILQ_INSERT_BEFORE(he, he2, list);
@@ -97,7 +97,7 @@
 	struct hsl_entry *he;
 	int ret;
 
-	assert(obj->hashpriv != NULL);
+	AN(obj->hashpriv);
 	he = obj->hashpriv;
 	LOCK(&hsl_mutex);
 	if (--he->refcnt == 0) {

Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -114,7 +114,7 @@
 		/* Redirect stdin/out/err */
 		AZ(close(0));
 		i = open("/dev/null", O_RDONLY);
-		assert(i == 0);
+		xxxassert(i == 0);
 		assert(dup2(child_fds[1], 1) == 1);
 		assert(dup2(child_fds[1], 2) == 2);
 		AZ(close(child_fds[0]));
@@ -137,9 +137,9 @@
 	AZ(close(child_fds[1]));
 	child_fds[1] = -1;
 
-	assert(ev_listen == NULL);
+	AZ(ev_listen);
 	e = ev_new();
-	assert(e != NULL);
+	XXXAN(e);
 	e->fd = child_fds[0];
 	e->fd_flags = EV_RD;
 	e->name = "Child listener";
@@ -147,9 +147,9 @@
 	AZ(ev_add(mgt_evb, e));
 	ev_listen = e;
 
-	assert(ev_poker == NULL);
+	AZ(ev_poker);
 	e = ev_new();
-	assert(e != NULL);
+	XXXAN(e);
 	e->timeout = 3.0;
 	e->callback = child_poker;
 	e->name = "child poker";
@@ -287,7 +287,7 @@
 	mgt_pid = getpid();
 
 	mgt_evb = ev_new_base();
-	assert(mgt_evb != NULL);
+	XXXAN(mgt_evb);
 
 	if (dflag)
 		mgt_cli_setup(0, 1, 1);
@@ -296,21 +296,21 @@
 		mgt_cli_telnet(T_arg);
 
 	e = ev_new();
-	assert(e != NULL);
+	XXXAN(e);
 	e->sig = SIGTERM;
 	e->callback = mgt_sigint;
 	e->name = "mgt_sigterm";
 	AZ(ev_add(mgt_evb, e));
 
 	e = ev_new();
-	assert(e != NULL);
+	XXXAN(e);
 	e->sig = SIGINT;
 	e->callback = mgt_sigint;
 	e->name = "mgt_sigint";
 	AZ(ev_add(mgt_evb, e));
 
 	e = ev_new();
-	assert(e != NULL);
+	XXXAN(e);
 	e->sig = SIGCHLD;
 	e->sig_flags = SA_NOCLDSTOP;
 	e->callback = mgt_sigchld;

Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -40,7 +40,7 @@
 	(void)av;
 	(void)priv;
 
-	assert (VSL_stats != NULL);
+	AN(VSL_stats);
 #define MAC_STAT(n,t,f,d) \
     cli_out(cli, "%12ju  " d "\n", (VSL_stats->n));
 #include "stat_field.h"
@@ -72,7 +72,7 @@
 	for (u = 1; av[u] != NULL; u++)
 		v += strlen(av[u]) + 3;
 	p = malloc(v);
-	assert(p != NULL);
+	XXXAN(p);
 	q = p;
 	for (u = 1; av[u] != NULL; u++) {
 		*q++ = '"';
@@ -90,7 +90,7 @@
 	*q++ = '\n';
 	v = q - p;
 	i = write(cli_o, p, v);
-	assert(i == v);
+	xxxassert(i == v);
 	free(p);
 
 	i = cli_readres(cli_i, &u, &p, 3.0);
@@ -149,7 +149,7 @@
 	for (cp = CLI_cmds; cp->request != NULL; cp++)
 		u++;
 	cli_proto = calloc(sizeof *cli_proto, u + 1);
-	assert(cli_proto != NULL);
+	XXXAN(cli_proto);
 	u = 0;
 	for (cp = mgt_cli_proto; cp->request != NULL; cp++)
 		cli_proto[u++] = *cp;
@@ -268,7 +268,7 @@
 		if (cp->nbuf == cp->lbuf) {
 			cp->lbuf += cp->lbuf;
 			cp->buf = realloc(cp->buf, cp->lbuf);
-			assert(cp->buf != NULL);
+			XXXAN(cp->buf);
 		}
 		i = read(cp->fdi, cp->buf + cp->nbuf, cp->lbuf - cp->nbuf);
 		if (i <= 0)
@@ -313,7 +313,7 @@
 	struct cli_port *cp;
 
 	cp = calloc(sizeof *cp, 1);
-	assert(cp != NULL);
+	XXXAN(cp);
 
 	sprintf(cp->name, "cli %d->%d", fdi, fdo);
 	cp->magic = CLI_PORT_MAGIC;
@@ -324,10 +324,10 @@
 
 	cp->lbuf = 4096;
 	cp->buf = malloc(cp->lbuf);
-	assert(cp->buf != NULL);
+	XXXAN(cp->buf);
 
 	cp->cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-	assert(cp->cli->sb != NULL);
+	XXXAN(cp->cli->sb);
 
 	cp->ev = calloc(sizeof *cp->ev, 1);
 	cp->ev->name = cp->name;
@@ -370,7 +370,7 @@
 		exit (2);
 	}
 	telnet_ev = ev_new();
-	assert(telnet_ev != NULL);
+	XXXAN(telnet_ev);
 	telnet_ev->fd = telnet_sock;
 	telnet_ev->fd_flags = POLLIN;
 	telnet_ev->callback = telnet_accept;

Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -292,12 +292,11 @@
 				q = strchr(p, '\n');
 				if (q == NULL)
 					q = strchr(p, '\0');
-				assert(q != NULL);
 				if (q > p + 52) {
 					q = p + 52;
 					while (q > p && *q != ' ')
 						q--;
-					assert(q != NULL);
+					AN(q);
 				}
 				cli_out(cli, "%20s %.*s\n", "", q - p, p);
 				p = q;

Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -83,7 +83,7 @@
 	struct vclprog *vp;
 
 	vp = calloc(sizeof *vp, 1);
-	assert(vp != NULL);
+	XXXAN(vp);
 	vp->name = strdup(name);
 	vp->fname = file;
 	TAILQ_INSERT_TAIL(&vclhead, vp, list);
@@ -95,7 +95,7 @@
 {
 	TAILQ_REMOVE(&vclhead, vp, list);
 	printf("unlink %s\n", vp->fname);
-	AZ(unlink(vp->fname));	/* XXX assert for now */
+	XXXAZ(unlink(vp->fname));
 	free(vp->fname);
 	free(vp->name);
 	free(vp);
@@ -126,7 +126,7 @@
 	struct vclprog *vp;
 
 	sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-	assert(sb != NULL);
+	XXXAN(sb);
 	if (b_arg != NULL) {
 		/*
 		 * XXX: should do a "HEAD /" on the -b argument to see that
@@ -149,7 +149,7 @@
 		    "}\n", addr, port ? port : "http");
 		free(addr);
 		free(port);
-		assert(buf != NULL);
+		AN(buf);
 		vf = VCC_Compile(sb, buf, NULL);
 		free(buf);
 	} else {
@@ -231,7 +231,7 @@
 	(void)priv;
 
 	sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-	assert(sb != NULL);
+	XXXAN(sb);
 	vf = VCC_Compile(sb, av[3], NULL);
 	vsb_finish(sb);
 	if (vsb_len(sb) > 0) {
@@ -262,7 +262,7 @@
 	(void)priv;
 
 	sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-	assert(sb != NULL);
+	XXXAN(sb);
 	vf = VCC_CompileFile(sb, av[3]);
 	vsb_finish(sb);
 	if (vsb_len(sb) > 0) {

Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -52,7 +52,6 @@
 	assert(b != NULL);
 	if (e == NULL)
 		e = strchr(b, '\0');
-	assert(e != NULL);
 
 	/* Truncate */
 	l = e - b;
@@ -185,7 +184,7 @@
 	slh.ptr = 0;
 	slh.start = sizeof slh + sizeof *params;
 	i = write(heritage.vsl_fd, &slh, sizeof slh);
-	assert(i == sizeof slh);
+	xxxassert(i == sizeof slh);
 	heritage.vsl_size = slh.start + size;
 	AZ(ftruncate(heritage.vsl_fd, (off_t)heritage.vsl_size));
 }
@@ -210,7 +209,7 @@
 	    PROT_READ|PROT_WRITE,
 	    MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED,
 	    heritage.vsl_fd, 0);
-	assert(loghead != MAP_FAILED);
+	xxxassert(loghead != MAP_FAILED);
 	VSL_stats = &loghead->stats;
 	pp = (void *)(loghead + 1);
 	memcpy(pp, params, sizeof *pp);

Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -92,7 +92,7 @@
 	if (bs < fsst.f_bsize)
 		bs = fsst.f_bsize;
 
-	assert(S_ISREG(st.st_mode));
+	xxxassert(S_ISREG(st.st_mode));
 
 	i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */
 
@@ -202,7 +202,7 @@
 	struct smf_sc *sc;
 
 	sc = calloc(sizeof *sc, 1);
-	assert(sc != NULL);
+	XXXAN(sc);
 	TAILQ_INIT(&sc->order);
 	TAILQ_INIT(&sc->free);
 	TAILQ_INIT(&sc->used);
@@ -218,9 +218,9 @@
 		asprintf(&p, "%s,", spec);
 	else
 		p = strdup(spec);
-	assert(p != NULL);
+	XXXAN(p);
 	size = strchr(p, ',');
-	assert(size != NULL);
+	XXXAN(size);
 
 	*size++ = '\0';
 
@@ -269,7 +269,7 @@
 	}
 
 	asprintf(&q, "%s/varnish.XXXXXX", p);
-	assert(q != NULL);
+	XXXAN(q);
 	sc->fd = mkstemp(q);
 	if (sc->fd < 0) {
 		fprintf(stderr,
@@ -279,7 +279,7 @@
 	}
 	AZ(unlink(q));
 	asprintf(&sc->filename, "%s (unlinked)", q);
-	assert(sc->filename != NULL);
+	XXXAN(sc->filename);
 	free(q);
 	smf_initfile(sc, size, 1);
 }
@@ -310,7 +310,7 @@
 
 	/* Split from front */
 	sp2 = malloc(sizeof *sp2);
-	assert(sp2 != NULL);
+	XXXAN(sp2);
 	VSL_stats->n_smf++;
 	*sp2 = *sp;
 
@@ -390,7 +390,7 @@
 	assert(bytes > 0);
 	CHECK_OBJ_NOTNULL(sp, SMF_MAGIC);
 	sp2 = malloc(sizeof *sp2);
-	assert(sp2 != NULL);
+	XXXAN(sp2);
 	VSL_stats->n_smf++;
 	*sp2 = *sp;
 
@@ -413,7 +413,7 @@
 	struct smf *sp, *sp2;
 
 	sp = calloc(sizeof *sp, 1);
-	assert(sp != NULL);
+	XXXAN(sp);
 	sp->magic = SMF_MAGIC;
 	sp->s.magic = STORAGE_MAGIC;
 	VSL_stats->n_smf++;
@@ -515,7 +515,7 @@
 	smf = alloc_smf(sc, size);
 	CHECK_OBJ_NOTNULL(smf, SMF_MAGIC);
 	UNLOCK(&sc->mtx);
-	assert(smf != NULL);
+	XXXAN(smf);
 	assert(smf->size == size);
 	smf->s.space = size;
 	smf->s.priv = smf;
@@ -542,7 +542,7 @@
 		return;
 	}
 	assert(size <= s->space);
-	assert(size > 0);	/* XXX: seen */
+	xxxassert(size > 0);	/* XXX: seen */
 	CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC);
 	assert(size <= smf->size);
 	sc = smf->sc;

Modified: trunk/varnish-cache/bin/varnishd/storage_malloc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_malloc.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/storage_malloc.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -18,10 +18,10 @@
 	struct sma *sma;
 
 	sma = calloc(sizeof *sma, 1);
-	assert(sma != NULL);
+	XXXAN(sma);
 	sma->s.priv = sma;
 	sma->s.ptr = malloc(size);
-	assert(sma->s.ptr != NULL);
+	XXXAN(sma->s.ptr);
 	sma->s.len = 0;
 	sma->s.space = size;
 	sma->s.fd = -1;

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2006-08-24 07:17:35 UTC (rev 913)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2006-08-24 07:57:07 UTC (rev 914)
@@ -57,8 +57,8 @@
 		q = p = strchr(s_arg, '\0');
 	else
 		q = p + 1;
-	assert(p != NULL);
-	assert(q != NULL);
+	xxxassert(p != NULL);
+	xxxassert(q != NULL);
 	if (!cmp_hash(&hcl_slinger, s_arg, p)) {
 		hp = &hcl_slinger;
 	} else if (!cmp_hash(&hsl_slinger, s_arg, p)) {
@@ -102,8 +102,8 @@
 		q = p = strchr(s_arg, '\0');
 	else
 		q = p + 1;
-	assert(p != NULL);
-	assert(q != NULL);
+	xxxassert(p != NULL);
+	xxxassert(q != NULL);
 	if (!cmp_storage(&sma_stevedore, s_arg, p)) {
 		stp = &sma_stevedore;
 	} else if (!cmp_storage(&smf_stevedore, s_arg, p)) {
@@ -267,12 +267,12 @@
 	i = read(pipes[1][0], buf, sizeof buf - 1);
 	buf[i] = '\0';
 	d_child = strtoul(buf, &p, 0);
-	assert(p != NULL);
+	xxxassert(p != NULL);
 	printf("New Pid %d\n", d_child);
-	assert(d_child != 0);
+	xxxassert(d_child != 0);
 	i = strlen(p);
 	j = write(pipes[1][1], p, i);
-	assert(j == i);
+	xxxassert(j == i);
 
 	while (1) {
 		if (pfd[0].fd == -1 && pfd[1].fd == -1)




More information about the varnish-commit mailing list