[master] ee1f86d Writing an article about the utility of asserts, I noticed some inconsistent whitespace with asserts.

Poul-Henning Kamp phk at varnish-cache.org
Mon Apr 30 08:31:31 CEST 2012


commit ee1f86d208ae2c3e4e72d956419bae1b4a20dc3c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 30 06:30:57 2012 +0000

    Writing an article about the utility of asserts, I noticed some inconsistent
    whitespace with asserts.

diff --git a/bin/varnishd/cache/cache_backend_poll.c b/bin/varnishd/cache/cache_backend_poll.c
index 85ad69e..ab405f9 100644
--- a/bin/varnishd/cache/cache_backend_poll.c
+++ b/bin/varnishd/cache/cache_backend_poll.c
@@ -500,7 +500,7 @@ VBP_Insert(struct backend *b, const struct vrt_backend_probe *p,
 	}
 
 	VTAILQ_FOREACH(vcl, &vt->vcls, list)
-		assert (vcl->probep != p);
+		assert(vcl->probep != p);
 
 	vcl = vbp_new_vcl(p, hosthdr);
 	Lck_Lock(&vbp_mtx);
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 6e6eafb..c53d945 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -525,7 +525,7 @@ BAN_Reload(const uint8_t *ban, unsigned len)
 
 	VTAILQ_FOREACH(b, &ban_head, list) {
 		t1 = ban_time(b->spec);
-		assert (t1 < t2);
+		assert(t1 < t2);
 		t2 = t1;
 		if (t1 == t0) {
 			Lck_Unlock(&ban_mtx);
diff --git a/bin/varnishd/cache/cache_dir_round_robin.c b/bin/varnishd/cache/cache_dir_round_robin.c
index 7d75473..350f18c 100644
--- a/bin/varnishd/cache/cache_dir_round_robin.c
+++ b/bin/varnishd/cache/cache_dir_round_robin.c
@@ -152,7 +152,7 @@ vrt_init_dir(struct cli *cli, struct director **bp, int idx,
 	te = t->members;
 	for (i = 0; i < t->nmember; i++, vh++, te++) {
 		vh->backend = bp[te->host];
-		AN (vh->backend);
+		AN(vh->backend);
 	}
 	vs->nhosts = t->nmember;
 	vs->next_host = 0;
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 0e8b11a..73aac72 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -326,7 +326,7 @@ ESI_Deliver(struct sess *sp)
 						p = e;
 						break;
 					}
-					assert (i == VGZ_OK || i == VGZ_END);
+					assert(i == VGZ_OK || i == VGZ_END);
 				} else {
 					/*
 					 * Ungzip'ed VEC, ungzip'ed ESI response
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 39ded77..5a41875 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -424,7 +424,7 @@ EXP_NukeOne(struct busyobj *bo, struct lru *lru)
 	Lck_Lock(&exp_mtx);
 	VTAILQ_FOREACH(oc, &lru->lru_head, lru_list) {
 		CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
-		assert (oc->timer_idx != BINHEAP_NOIDX);
+		assert(oc->timer_idx != BINHEAP_NOIDX);
 		/*
 		 * It wont release any space if we cannot release the last
 		 * reference, besides, if somebody else has a reference,
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index e019702..ee9147d 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -666,7 +666,7 @@ FetchBody(struct worker *wrk, void *priv)
 				uu += st->len;
 			if (bo->do_stream)
 				/* Streaming might have started freeing stuff */
-				assert (uu <= obj->len);
+				assert(uu <= obj->len);
 
 			else
 				assert(uu == obj->len);
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index bcdfa6d..f977400 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -224,7 +224,7 @@ wslr(struct vsl_log *vsl, enum VSL_tag_e tag, int id, txt t)
 	/* Wrap if necessary */
 	if (VSL_END(vsl->wlp, l) >= vsl->wle)
 		VSL_Flush(vsl, 1);
-	assert (VSL_END(vsl->wlp, l) < vsl->wle);
+	assert(VSL_END(vsl->wlp, l) < vsl->wle);
 	memcpy(VSL_DATA(vsl->wlp), t.b, l);
 	vsl_hdr(tag, vsl->wlp, l, id);
 	vsl->wlp = VSL_END(vsl->wlp, l);
diff --git a/bin/varnishd/storage/storage_persistent.c b/bin/varnishd/storage/storage_persistent.c
index d206a86..6118fbf 100644
--- a/bin/varnishd/storage/storage_persistent.c
+++ b/bin/varnishd/storage/storage_persistent.c
@@ -216,7 +216,7 @@ smp_open_segs(struct smp_sc *sc, struct smp_signctx *ctx)
 		}
 	}
 
-	assert (l >= sc->free_reserve);
+	assert(l >= sc->free_reserve);
 
 
 	sg1 = NULL;
diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 8bb19d4..2c6dd3f 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -268,7 +268,7 @@ VTCP_close(int *s)
 
 	i = close(*s);
 
-	assert (VTCP_Check(i));
+	assert(VTCP_Check(i));
 	*s = -1;
 }
 
diff --git a/lib/libvcl/vcc_action.c b/lib/libvcl/vcc_action.c
index 044d12d..b4713e6 100644
--- a/lib/libvcl/vcc_action.c
+++ b/lib/libvcl/vcc_action.c
@@ -352,7 +352,7 @@ vcc_ParseAction(struct vcc *tl)
 	const struct symbol *sym;
 
 	at = tl->t;
-	assert (at->tok == ID);
+	assert(at->tok == ID);
 	for(atp = action_table; atp->name != NULL; atp++) {
 		if (vcc_IdIs(at, atp->name)) {
 			if (atp->bitmask != 0)
diff --git a/lib/libvcl/vcc_symb.c b/lib/libvcl/vcc_symb.c
index 4066e56..691f6b8 100644
--- a/lib/libvcl/vcc_symb.c
+++ b/lib/libvcl/vcc_symb.c
@@ -118,7 +118,7 @@ VCC_FindSymbol(struct vcc *tl, const struct token *t, enum symkind kind)
 		if (sym->kind == SYM_WILDCARD &&
 		   (t->e - t->b > sym->nlen) &&
 		   !memcmp(sym->name, t->b, sym->nlen)) {
-			AN (sym->wildcard);
+			AN(sym->wildcard);
 			return (sym->wildcard(tl, t, sym));
 		}
 		if (kind != SYM_NONE && kind != sym->kind)



More information about the varnish-commit mailing list