[6.0] debba3969 Merge from VTEST:
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 18 09:21:06 UTC 2023
commit debba396929db57f8e79014a0cbc3a8a9377025c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Dec 2 11:53:35 2019 +0000
Merge from VTEST:
Avoid VSB_printf for static strings
Done with the following semantic patch for Coccinelle:
@@
expression vsb, fmt;
@@
- VSB_printf(vsb, fmt);
+ VSB_cat(vsb, fmt);
This patch is available in the Varnish source tree.
diff --git a/bin/varnishtest/vtc_log.c b/bin/varnishtest/vtc_log.c
index 1e6e321e8..94cade1ea 100644
--- a/bin/varnishtest/vtc_log.c
+++ b/bin/varnishtest/vtc_log.c
@@ -246,7 +246,7 @@ vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
else {
for (l = 0; l < len; l++, ss++) {
if (l > 512) {
- VSB_printf(vl->vsb, "...");
+ VSB_cat(vl->vsb, "...");
break;
}
if (nl) {
@@ -255,13 +255,13 @@ vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
}
VSB_printf(vl->vsb, " %02x", *ss);
if ((l & 0xf) == 0xf) {
- VSB_printf(vl->vsb, "\n");
+ VSB_cat(vl->vsb, "\n");
nl = 1;
}
}
}
if (!nl)
- VSB_printf(vl->vsb, "\n");
+ VSB_cat(vl->vsb, "\n");
REL_VL(vl);
if (lvl == 0)
vtc_logfail();
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index d942a490a..27754d04e 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -508,7 +508,7 @@ i_mode(void)
/*
* Build $PATH which can find all programs in the build tree
*/
- VSB_printf(vsb, "PATH=");
+ VSB_cat(vsb, "PATH=");
sep = "";
#define VTC_PROG(l) \
do { \
@@ -690,7 +690,7 @@ main(int argc, char * const *argv)
AN(cbvsb);
setbuf(stdout, NULL);
setbuf(stderr, NULL);
- while ((ch = getopt(argc, argv, "b:CD:hij:kLln:p:qt:vW")) != -1) {
+ while ((ch = getopt(argc, argv, "b:CD:hij:kLln:p:qt:v")) != -1) {
switch (ch) {
case 'b':
if (VNUM_2bytes(optarg, &bufsiz, 0)) {
@@ -734,7 +734,7 @@ main(int argc, char * const *argv)
ntest = strtoul(optarg, NULL, 0);
break;
case 'p':
- VSB_printf(params_vsb, " -p ");
+ VSB_cat(params_vsb, " -p ");
VSB_quote(params_vsb, optarg, -1, 0);
break;
case 'q':
diff --git a/bin/varnishtest/vtc_proxy.c b/bin/varnishtest/vtc_proxy.c
index a72221573..15ef93d76 100644
--- a/bin/varnishtest/vtc_proxy.c
+++ b/bin/varnishtest/vtc_proxy.c
@@ -100,9 +100,9 @@ vtc_send_proxy(int fd, int version, const struct suckaddr *sac,
if (version == 1) {
VSB_bcat(vsb, vpx1_sig, sizeof(vpx1_sig));
if (proto == PF_INET6)
- VSB_printf(vsb, " TCP6 ");
+ VSB_cat(vsb, " TCP6 ");
else if (proto == PF_INET)
- VSB_printf(vsb, " TCP4 ");
+ VSB_cat(vsb, " TCP4 ");
VTCP_name(sac, hc, sizeof(hc), pc, sizeof(pc));
VTCP_name(sas, hs, sizeof(hs), ps, sizeof(ps));
VSB_printf(vsb, "%s %s %s %s\r\n", hc, hs, pc, ps);
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index b0c27bac6..c246bf0e1 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -408,7 +408,7 @@ varnish_launch(struct varnish *v)
vtc_log(v->vl, 2, "Launch");
vsb = VSB_new_auto();
AN(vsb);
- VSB_printf(vsb, "cd ${pwd} &&");
+ VSB_cat(vsb, "cd ${pwd} &&");
VSB_printf(vsb, " exec varnishd %s -d -n %s",
v->jail, v->workdir);
VSB_cat(vsb, VSB_data(params_vsb));
@@ -419,13 +419,13 @@ varnish_launch(struct varnish *v)
VSB_cat(vsb, " -p debug=+vmod_so_keep");
VSB_cat(vsb, " -p debug=+vsm_keep");
}
- VSB_printf(vsb, " -l 2m");
- VSB_printf(vsb, " -p auto_restart=off");
- VSB_printf(vsb, " -p syslog_cli_traffic=off");
- VSB_printf(vsb, " -p sigsegv_handler=on");
- VSB_printf(vsb, " -p thread_pool_min=10");
- VSB_printf(vsb, " -p debug=+vtc_mode");
- VSB_printf(vsb, " -p vsl_mask=+Debug");
+ VSB_cat(vsb, " -l 2m");
+ VSB_cat(vsb, " -p auto_restart=off");
+ VSB_cat(vsb, " -p syslog_cli_traffic=off");
+ VSB_cat(vsb, " -p sigsegv_handler=on");
+ VSB_cat(vsb, " -p thread_pool_min=10");
+ VSB_cat(vsb, " -p debug=+vtc_mode");
+ VSB_cat(vsb, " -p vsl_mask=+Debug");
if (!v->has_a_arg) {
VSB_printf(vsb, " -a '%s'", "127.0.0.1:0");
if (v->proto != NULL)
More information about the varnish-commit
mailing list