Commit debba396 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Dridi Boukelmoune

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.
parent 54148d72
...@@ -246,7 +246,7 @@ vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx, ...@@ -246,7 +246,7 @@ vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
else { else {
for (l = 0; l < len; l++, ss++) { for (l = 0; l < len; l++, ss++) {
if (l > 512) { if (l > 512) {
VSB_printf(vl->vsb, "..."); VSB_cat(vl->vsb, "...");
break; break;
} }
if (nl) { if (nl) {
...@@ -255,13 +255,13 @@ vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx, ...@@ -255,13 +255,13 @@ vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
} }
VSB_printf(vl->vsb, " %02x", *ss); VSB_printf(vl->vsb, " %02x", *ss);
if ((l & 0xf) == 0xf) { if ((l & 0xf) == 0xf) {
VSB_printf(vl->vsb, "\n"); VSB_cat(vl->vsb, "\n");
nl = 1; nl = 1;
} }
} }
} }
if (!nl) if (!nl)
VSB_printf(vl->vsb, "\n"); VSB_cat(vl->vsb, "\n");
REL_VL(vl); REL_VL(vl);
if (lvl == 0) if (lvl == 0)
vtc_logfail(); vtc_logfail();
......
...@@ -508,7 +508,7 @@ i_mode(void) ...@@ -508,7 +508,7 @@ i_mode(void)
/* /*
* Build $PATH which can find all programs in the build tree * Build $PATH which can find all programs in the build tree
*/ */
VSB_printf(vsb, "PATH="); VSB_cat(vsb, "PATH=");
sep = ""; sep = "";
#define VTC_PROG(l) \ #define VTC_PROG(l) \
do { \ do { \
...@@ -690,7 +690,7 @@ main(int argc, char * const *argv) ...@@ -690,7 +690,7 @@ main(int argc, char * const *argv)
AN(cbvsb); AN(cbvsb);
setbuf(stdout, NULL); setbuf(stdout, NULL);
setbuf(stderr, 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) { switch (ch) {
case 'b': case 'b':
if (VNUM_2bytes(optarg, &bufsiz, 0)) { if (VNUM_2bytes(optarg, &bufsiz, 0)) {
...@@ -734,7 +734,7 @@ main(int argc, char * const *argv) ...@@ -734,7 +734,7 @@ main(int argc, char * const *argv)
ntest = strtoul(optarg, NULL, 0); ntest = strtoul(optarg, NULL, 0);
break; break;
case 'p': case 'p':
VSB_printf(params_vsb, " -p "); VSB_cat(params_vsb, " -p ");
VSB_quote(params_vsb, optarg, -1, 0); VSB_quote(params_vsb, optarg, -1, 0);
break; break;
case 'q': case 'q':
......
...@@ -100,9 +100,9 @@ vtc_send_proxy(int fd, int version, const struct suckaddr *sac, ...@@ -100,9 +100,9 @@ vtc_send_proxy(int fd, int version, const struct suckaddr *sac,
if (version == 1) { if (version == 1) {
VSB_bcat(vsb, vpx1_sig, sizeof(vpx1_sig)); VSB_bcat(vsb, vpx1_sig, sizeof(vpx1_sig));
if (proto == PF_INET6) if (proto == PF_INET6)
VSB_printf(vsb, " TCP6 "); VSB_cat(vsb, " TCP6 ");
else if (proto == PF_INET) else if (proto == PF_INET)
VSB_printf(vsb, " TCP4 "); VSB_cat(vsb, " TCP4 ");
VTCP_name(sac, hc, sizeof(hc), pc, sizeof(pc)); VTCP_name(sac, hc, sizeof(hc), pc, sizeof(pc));
VTCP_name(sas, hs, sizeof(hs), ps, sizeof(ps)); VTCP_name(sas, hs, sizeof(hs), ps, sizeof(ps));
VSB_printf(vsb, "%s %s %s %s\r\n", hc, hs, pc, ps); VSB_printf(vsb, "%s %s %s %s\r\n", hc, hs, pc, ps);
......
...@@ -408,7 +408,7 @@ varnish_launch(struct varnish *v) ...@@ -408,7 +408,7 @@ varnish_launch(struct varnish *v)
vtc_log(v->vl, 2, "Launch"); vtc_log(v->vl, 2, "Launch");
vsb = VSB_new_auto(); vsb = VSB_new_auto();
AN(vsb); AN(vsb);
VSB_printf(vsb, "cd ${pwd} &&"); VSB_cat(vsb, "cd ${pwd} &&");
VSB_printf(vsb, " exec varnishd %s -d -n %s", VSB_printf(vsb, " exec varnishd %s -d -n %s",
v->jail, v->workdir); v->jail, v->workdir);
VSB_cat(vsb, VSB_data(params_vsb)); VSB_cat(vsb, VSB_data(params_vsb));
...@@ -419,13 +419,13 @@ varnish_launch(struct varnish *v) ...@@ -419,13 +419,13 @@ varnish_launch(struct varnish *v)
VSB_cat(vsb, " -p debug=+vmod_so_keep"); VSB_cat(vsb, " -p debug=+vmod_so_keep");
VSB_cat(vsb, " -p debug=+vsm_keep"); VSB_cat(vsb, " -p debug=+vsm_keep");
} }
VSB_printf(vsb, " -l 2m"); VSB_cat(vsb, " -l 2m");
VSB_printf(vsb, " -p auto_restart=off"); VSB_cat(vsb, " -p auto_restart=off");
VSB_printf(vsb, " -p syslog_cli_traffic=off"); VSB_cat(vsb, " -p syslog_cli_traffic=off");
VSB_printf(vsb, " -p sigsegv_handler=on"); VSB_cat(vsb, " -p sigsegv_handler=on");
VSB_printf(vsb, " -p thread_pool_min=10"); VSB_cat(vsb, " -p thread_pool_min=10");
VSB_printf(vsb, " -p debug=+vtc_mode"); VSB_cat(vsb, " -p debug=+vtc_mode");
VSB_printf(vsb, " -p vsl_mask=+Debug"); VSB_cat(vsb, " -p vsl_mask=+Debug");
if (!v->has_a_arg) { if (!v->has_a_arg) {
VSB_printf(vsb, " -a '%s'", "127.0.0.1:0"); VSB_printf(vsb, " -a '%s'", "127.0.0.1:0");
if (v->proto != NULL) if (v->proto != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment