[master] 70d5051fe Style(9) and whitespace OCD, varnishtest edition

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Mar 12 19:23:07 UTC 2019


commit 70d5051fe755ccd4a9b789d9ce83cf2eeb9b9622
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Mar 12 20:10:06 2019 +0100

    Style(9) and whitespace OCD, varnishtest edition
    
    See dd28fc739f47d08a95b3f29e39ec2db73d2fe79f for the whole story.

diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 8a9057333..f6c686d17 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -464,7 +464,7 @@ fail_out(void)
 
 	if (once++) {
 		vtc_log(vltop, 1, "failure during reset");
-		return(vtc_error);
+		return (vtc_error);
 	}
 	old_err = vtc_error;
 	if (!vtc_stop)
@@ -543,5 +543,5 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
 
 	vtc_thread = pthread_self();
 	parse_string(script, cmds, NULL, vltop);
-	return(fail_out());
+	return (fail_out());
 }
diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index 72b7cfb71..7d199d2ef 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -122,11 +122,11 @@ client_tcp_connect(struct vtclog *vl, const char *addr, double tmo,
 
 	fd = VTCP_open(addr, NULL, tmo, errp);
 	if (fd < 0)
-		return fd;
+		return (fd);
 	VTCP_myname(fd, mabuf, sizeof mabuf, mpbuf, sizeof mpbuf);
 	vtc_log(vl, 3, "connected fd %d from %s %s to %s", fd, mabuf, mpbuf,
 		addr);
-	return fd;
+	return (fd);
 }
 
 /* cf. VTCP_Open() */
@@ -183,10 +183,10 @@ client_uds_connect(struct vtclog *vl, const char *path, double tmo,
 	fd = VUS_resolver(path, uds_open, &tmo, errp);
 	if (fd < 0) {
 		*errp = strerror(errno);
-		return fd;
+		return (fd);
 	}
 	vtc_log(vl, 3, "connected fd %d to %s", fd, path);
-	return fd;
+	return (fd);
 }
 
 /**********************************************************************
diff --git a/bin/varnishtest/vtc_h2_hpack.c b/bin/varnishtest/vtc_h2_hpack.c
index e52f16855..f7343cab1 100644
--- a/bin/varnishtest/vtc_h2_hpack.c
+++ b/bin/varnishtest/vtc_h2_hpack.c
@@ -160,7 +160,7 @@ huff_simulate(const char *str, int ilen, int huff)
 		olen += coding_table[(unsigned char)*str].size;
 		str++;
 	}
-	return ((olen+7)/8);
+	return ((olen + 7) / 8);
 }
 
 static enum hpk_result
@@ -360,7 +360,7 @@ HPK_DecHdr(struct hpk_iter *iter, struct hpk_hdr *header)
 	else if (*iter->buf >> 5 == 1) {
 		if (hpk_done != num_decode(&num, iter, 5))
 			return (hpk_err);
-		return HPK_ResizeTbl(iter->ctx, num);
+		return (HPK_ResizeTbl(iter->ctx, num));
 	} else {
 		return (hpk_err);
 	}
diff --git a/bin/varnishtest/vtc_haproxy.c b/bin/varnishtest/vtc_haproxy.c
index 82ce237bc..7a54a7b0b 100644
--- a/bin/varnishtest/vtc_haproxy.c
+++ b/bin/varnishtest/vtc_haproxy.c
@@ -169,11 +169,11 @@ haproxy_cli_tcp_connect(struct vtclog *vl, const char *addr, double tmo,
 
 	fd = VTCP_open(addr, NULL, tmo, errp);
 	if (fd < 0)
-		return fd;
+		return (fd);
 	VTCP_myname(fd, mabuf, sizeof mabuf, mpbuf, sizeof mpbuf);
 	vtc_log(vl, 3,
 	    "CLI connected fd %d from %s %s to %s", fd, mabuf, mpbuf, addr);
-	return fd;
+	return (fd);
 }
 
 /*
@@ -471,7 +471,7 @@ haproxy_cli_new(struct haproxy *h)
 	hc->rxbuf = malloc(hc->rxbuf_sz);
 	AN(hc->rxbuf);
 
-	return hc;
+	return (hc);
 }
 
 static void
@@ -735,7 +735,7 @@ haproxy_build_backends(struct haproxy *h, const char *vsb_data)
 
 	s = strdup(vsb_data);
 	if (!s)
-		return -1;
+		return (-1);
 
 	p = s;
 	while (1) {
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 3e928cd49..0c772f50d 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -305,33 +305,33 @@ cmd_var_resolve(struct http *hp, char *spec)
 {
 	char **hh, *hdr;
 	if (!strcmp(spec, "remote.ip"))
-		return(hp->rem_ip);
+		return (hp->rem_ip);
 	if (!strcmp(spec, "remote.port"))
-		return(hp->rem_port);
+		return (hp->rem_port);
 	if (!strcmp(spec, "remote.path"))
-		return(hp->rem_path);
+		return (hp->rem_path);
 	if (!strcmp(spec, "req.method"))
-		return(hp->req[0]);
+		return (hp->req[0]);
 	if (!strcmp(spec, "req.url"))
-		return(hp->req[1]);
+		return (hp->req[1]);
 	if (!strcmp(spec, "req.proto"))
-		return(hp->req[2]);
+		return (hp->req[2]);
 	if (!strcmp(spec, "resp.proto"))
-		return(hp->resp[0]);
+		return (hp->resp[0]);
 	if (!strcmp(spec, "resp.status"))
-		return(hp->resp[1]);
+		return (hp->resp[1]);
 	if (!strcmp(spec, "resp.reason"))
-		return(hp->resp[2]);
+		return (hp->resp[2]);
 	if (!strcmp(spec, "resp.chunklen"))
-		return(hp->chunklen);
+		return (hp->chunklen);
 	if (!strcmp(spec, "req.bodylen"))
-		return(hp->bodylen);
+		return (hp->bodylen);
 	if (!strcmp(spec, "req.body"))
-		return(hp->body != NULL ? hp->body : spec);
+		return (hp->body != NULL ? hp->body : spec);
 	if (!strcmp(spec, "resp.bodylen"))
-		return(hp->bodylen);
+		return (hp->bodylen);
 	if (!strcmp(spec, "resp.body"))
-		return(hp->body != NULL ? hp->body : spec);
+		return (hp->body != NULL ? hp->body : spec);
 	if (!strncmp(spec, "req.http.", 9)) {
 		hh = hp->req;
 		hdr = spec + 9;
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index e942bab17..cb15ebe82 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -881,7 +881,7 @@ find_header(const struct hpk_hdr *h, const char *k)
 	int kl = strlen(k);
 	while (h->t) {
 		if (kl == h->key.len  && !strncasecmp(h->key.ptr, k, kl))
-			return h->value.ptr;
+			return (h->value.ptr);
 		h++;
 	}
 	return (NULL);
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 0f4b144d2..f90a92973 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -639,7 +639,7 @@ read_file(const char *fn, int ntest)
 		    " 'vtest' or 'varnishtest'\n", fn);
 		free(p);
 		vtc_skip++;
-		return(2);
+		return (2);
 	}
 	ALLOC_OBJ(tp, TST_MAGIC);
 	AN(tp);
@@ -647,7 +647,7 @@ read_file(const char *fn, int ntest)
 	tp->script = p;
 	tp->ntodo = ntest;
 	VTAILQ_INSERT_TAIL(&tst_head, tp, list);
-	return(0);
+	return (0);
 }
 
 /**********************************************************************
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 02f6da13f..90e4d403d 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -869,10 +869,10 @@ do_expect_cb(void *priv, const struct VSC_point * const pt)
 	struct stat_priv *sp = priv;
 
 	if (pt == NULL)
-		return(0);
+		return (0);
 
 	if (fnmatch(sp->target_pattern, pt->name, 0))
-		return(0);
+		return (0);
 
 	AZ(strcmp(pt->ctype, "uint64_t"));
 	AN(pt->ptr);


More information about the varnish-commit mailing list