[master] 761905d Remove another 25 unreachable statements
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jan 18 14:00:05 CET 2017
commit 761905d49611e67049ecf5035958dff0ff3b33ee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jan 18 12:59:19 2017 +0000
Remove another 25 unreachable statements
diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c
index af7e6a1..81396b5 100644
--- a/bin/varnishtest/vtc_logexp.c
+++ b/bin/varnishtest/vtc_logexp.c
@@ -375,34 +375,22 @@ logexp_start(struct logexp *le)
AN(le->vsl);
AZ(le->vslq);
- if (le->n_arg == NULL) {
+ if (le->n_arg == NULL)
vtc_fatal(le->vl, "-v argument not given");
- return;
- }
- if (VSM_n_Arg(le->vsm, VSB_data(le->n_arg)) <= 0) {
+ if (VSM_n_Arg(le->vsm, VSB_data(le->n_arg)) <= 0)
vtc_fatal(le->vl, "-v argument error: %s",
VSM_Error(le->vsm));
- return;
- }
- if (VSM_Open(le->vsm)) {
+ if (VSM_Open(le->vsm))
vtc_fatal(le->vl, "VSM_Open: %s", VSM_Error(le->vsm));
- return;
- }
AN(le->vsl);
c = VSL_CursorVSM(le->vsl, le->vsm,
(le->d_arg ? 0 : VSL_COPT_TAIL) | VSL_COPT_BATCH);
- if (c == NULL) {
+ if (c == NULL)
vtc_fatal(le->vl, "VSL_CursorVSM: %s", VSL_Error(le->vsl));
- logexp_close(le);
- return;
- }
le->vslq = VSLQ_New(le->vsl, &c, le->g_arg, le->query);
if (le->vslq == NULL) {
VSL_DeleteCursor(c);
vtc_fatal(le->vl, "VSLQ_New: %s", VSL_Error(le->vsl));
- AZ(le->vslq);
- logexp_close(le);
- return;
}
AZ(c);
@@ -442,19 +430,15 @@ cmd_logexp_expect(CMD_ARGS)
(void)cmd;
CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC);
- if (av[1] == NULL || av[2] == NULL || av[3] == NULL) {
+ if (av[1] == NULL || av[2] == NULL || av[3] == NULL)
vtc_fatal(vl, "Syntax error");
- return;
- }
if (!strcmp(av[1], "*"))
skip_max = LE_ANY;
else {
skip_max = (int)strtol(av[1], &end, 10);
- if (*end != '\0' || skip_max < 0) {
+ if (*end != '\0' || skip_max < 0)
vtc_fatal(vl, "Not a positive integer: '%s'", av[1]);
- return;
- }
}
if (!strcmp(av[2], "*"))
vxid = LE_ANY;
@@ -462,10 +446,8 @@ cmd_logexp_expect(CMD_ARGS)
vxid = LE_LAST;
else {
vxid = (int)strtol(av[2], &end, 10);
- if (*end != '\0' || vxid < 0) {
+ if (*end != '\0' || vxid < 0)
vtc_fatal(vl, "Not a positive integer: '%s'", av[2]);
- return;
- }
}
if (!strcmp(av[3], "*"))
tag = LE_ANY;
@@ -473,19 +455,15 @@ cmd_logexp_expect(CMD_ARGS)
tag = LE_LAST;
else {
tag = VSL_Name2Tag(av[3], strlen(av[3]));
- if (tag < 0) {
+ if (tag < 0)
vtc_fatal(vl, "Unknown tag name: '%s'", av[3]);
- return;
- }
}
vre = NULL;
if (av[4]) {
vre = VRE_compile(av[4], 0, &err, &pos);
- if (vre == NULL) {
+ if (vre == NULL)
vtc_fatal(vl, "Regex error (%s): '%s' pos %d",
err, av[4], pos);
- return;
- }
}
ALLOC_OBJ(test, LOGEXP_TEST_MAGIC);
@@ -558,11 +536,9 @@ cmd_logexpect(CMD_ARGS)
if (vtc_error)
break;
if (!strcmp(*av, "-wait")) {
- if (!le->run) {
+ if (!le->run)
vtc_fatal(le->vl, "logexp not -started '%s'",
*av);
- return;
- }
logexp_wait(le);
continue;
}
@@ -576,10 +552,8 @@ cmd_logexpect(CMD_ARGS)
AZ(le->run);
if (!strcmp(*av, "-v")) {
- if (av[1] == NULL) {
+ if (av[1] == NULL)
vtc_fatal(le->vl, "Missing -v argument");
- return;
- }
if (le->n_arg != NULL)
VSB_destroy(&le->n_arg);
vsb = VSB_new_auto();
@@ -594,33 +568,25 @@ cmd_logexpect(CMD_ARGS)
continue;
}
if (!strcmp(*av, "-d")) {
- if (av[1] == NULL) {
+ if (av[1] == NULL)
vtc_fatal(le->vl, "Missing -d argument");
- return;
- }
le->d_arg = atoi(av[1]);
av++;
continue;
}
if (!strcmp(*av, "-g")) {
- if (av[1] == NULL) {
+ if (av[1] == NULL)
vtc_fatal(le->vl, "Missing -g argument");
- return;
- }
le->g_arg = VSLQ_Name2Grouping(av[1], strlen(av[1]));
- if (le->g_arg < 0) {
+ if (le->g_arg < 0)
vtc_fatal(le->vl, "Unknown grouping '%s'",
av[1]);
- return;
- }
av++;
continue;
}
if (!strcmp(*av, "-q")) {
- if (av[1] == NULL) {
+ if (av[1] == NULL)
vtc_fatal(le->vl, "Missing -q argument");
- return;
- }
REPLACE(le->query, av[1]);
av++;
continue;
@@ -641,10 +607,8 @@ cmd_logexpect(CMD_ARGS)
continue;
}
vtc_fatal(le->vl, "%s", VSL_Error(le->vsl));
- return;
}
vtc_fatal(le->vl, "Unknown logexp argument: %s", *av);
- return;
}
logexp_spec(le, *av);
}
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 1bc8789..48ef3f8 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -116,11 +116,9 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
cmd, errno, strerror(errno));
}
i = VCLI_ReadResult(v->cli_fd, &retval, &r, vtc_maxdur);
- if (i != 0) {
+ if (i != 0)
vtc_fatal(v->vl, "CLI failed (%s) = %d %u %s",
cmd, i, retval, r);
- return ((enum VCLI_status_e)retval);
- }
AZ(i);
vtc_log(v->vl, 3, "CLI RX %u", retval);
vtc_dump(v->vl, 4, "CLI RX", r, -1);
@@ -172,12 +170,9 @@ wait_running(const struct varnish *v)
if (st != CLIS_OK)
vtc_fatal(v->vl,
"CLI status command failed: %u %s", st, r);
- if (!strcmp(r, "Child in state stopped")) {
+ if (!strcmp(r, "Child in state stopped"))
vtc_fatal(v->vl,
"Child stopped before running: %u %s", st, r);
- free(r);
- break;
- }
if (!strcmp(r, "Child in state running")) {
free(r);
break;
@@ -503,7 +498,6 @@ varnish_launch(struct varnish *v)
AZ(close(v->cli_fd));
v->cli_fd = -1;
vtc_fatal(v->vl, "FAIL no CLI connection accepted");
- return;
}
AZ(close(v->cli_fd));
@@ -754,7 +748,6 @@ varnish_vcl(struct varnish *v, const char *vcl, int fail, char **resp)
VSB_destroy(&vsb);
vtc_fatal(v->vl,
"VCL compilation succeeded expected failure");
- return;
} else if (u == CLIS_OK) {
VSB_clear(vsb);
VSB_printf(vsb, "vcl.use vcl%d", v->vcl_nbr);
@@ -765,7 +758,6 @@ varnish_vcl(struct varnish *v, const char *vcl, int fail, char **resp)
VSB_destroy(&vsb);
vtc_fatal(v->vl,
"VCL compilation failed expected success");
- return;
} else {
vtc_log(v->vl, 2, "VCL compilation failed (as expected)");
}
@@ -807,7 +799,6 @@ varnish_vclbackend(struct varnish *v, const char *vcl)
VSB_destroy(&vsb);
VSB_destroy(&vsb2);
vtc_fatal(v->vl, "FAIL VCL does not compile");
- return;
}
VSB_clear(vsb);
VSB_printf(vsb, "vcl.use vcl%d", v->vcl_nbr);
@@ -967,10 +958,8 @@ varnish_expect(const struct varnish *v, char * const *av)
continue;
}
- if (not) {
+ if (not)
vtc_fatal(v->vl, "Found (not expected): %s", av[0]+1);
- return;
- }
good = 0;
ref = strtoumax(av[2], &p, 0);
More information about the varnish-commit
mailing list