[master] bd3b87ba2 Avoid VSB_printf for plain text

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Nov 8 09:20:07 UTC 2019


commit bd3b87ba204d8313e8ad58de0a23f21206d549df
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Nov 8 10:05:03 2019 +0100

    Avoid VSB_printf for plain text
    
    We have a new printf_nofmt.cocci semantic patch to catch future
    offenders.

diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index d51da01a2..97538cade 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -505,7 +505,7 @@ vbp_bitmap(struct vsb *vsb, char c, uint64_t map, const char *lbl)
 	int i;
 	uint64_t u = (1ULL << 63);
 
-	VSB_printf(vsb, "  ");
+	VSB_cat(vsb, "  ");
 	for (i = 0; i < 64; i++) {
 		if (map & u)
 			VSB_putc(vsb, c);
@@ -539,7 +539,7 @@ VBP_Status(struct vsb *vsb, const struct backend *be, int details, int json)
 	}
 
 	if (json) {
-		VSB_printf(vsb, "{\n");
+		VSB_cat(vsb, "{\n");
 		VSB_indent(vsb, 2);
 #define BITMAP(nn, cc, tt, bb)					\
 		VSB_printf(vsb, "\"bits_%c\": %ju,\n", cc, vt->nn);
@@ -548,8 +548,8 @@ VBP_Status(struct vsb *vsb, const struct backend *be, int details, int json)
 		VSB_printf(vsb, "\"threshold\": %u,\n", vt->threshold);
 		VSB_printf(vsb, "\"window\": %u", vt->window);
 		VSB_indent(vsb, -2);
-		VSB_printf(vsb, "\n");
-		VSB_printf(vsb, "},\n");
+		VSB_cat(vsb, "\n");
+		VSB_cat(vsb, "},\n");
 		return;
 	}
 
@@ -558,7 +558,7 @@ VBP_Status(struct vsb *vsb, const struct backend *be, int details, int json)
 	    vt->good, vt->threshold, vt->window);
 	VSB_printf(vsb,
 	    "  Average response time of good probes: %.6f\n", vt->avg);
-	VSB_printf(vsb,
+	VSB_cat(vsb,
 	    "  Oldest ======================"
 	    "============================ Newest\n");
 
@@ -588,8 +588,8 @@ vbp_build_req(struct vbp_target *vt, const struct vrt_backend_probe *vbp,
 		    vbp->url != NULL ?  vbp->url : "/");
 		if (be->hosthdr != NULL)
 			VSB_printf(vsb, "Host: %s\r\n", be->hosthdr);
-		VSB_printf(vsb, "Connection: close\r\n");
-		VSB_printf(vsb, "\r\n");
+		VSB_cat(vsb, "Connection: close\r\n");
+		VSB_cat(vsb, "\r\n");
 	}
 	AZ(VSB_finish(vsb));
 	vt->req = strdup(VSB_data(vsb));
diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index 0c1098da9..192347f3d 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -285,9 +285,9 @@ VDI_Panic(const struct director *d, struct vsb *vsb, const char *nm)
 	if (d->vdir->methods->panic != NULL)
 		d->vdir->methods->panic(d, vsb);
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 8fae5c619..c5ad6eb8e 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -133,13 +133,13 @@ PAN_already(struct vsb *vsb, const void *ptr)
 	int i;
 
 	if (ptr == NULL) {
-		VSB_printf(vsb, "},\n");
+		VSB_cat(vsb, "},\n");
 		return (1);
 	}
 	for (i = 0; i < already_idx; i++) {
 		if (already_list[i] == ptr) {
-			VSB_printf(vsb, "  [Already dumped, see above]\n");
-			VSB_printf(vsb, "},\n");
+			VSB_cat(vsb, "  [Already dumped, see above]\n");
+			VSB_cat(vsb, "},\n");
 			return (1);
 		}
 	}
@@ -160,7 +160,7 @@ pan_ws(struct vsb *vsb, const struct ws *ws)
 	VSB_indent(vsb, 2);
 	PAN_CheckMagic(vsb, ws, WS_MAGIC);
 	if (ws->id[0] != '\0' && (!(ws->id[0] & 0x20)))
-		VSB_printf(vsb, "OVERFLOWED ");
+		VSB_cat(vsb, "OVERFLOWED ");
 	VSB_printf(vsb, "id = \"%s\",\n", ws->id);
 	VSB_printf(vsb, "{s, f, r, e} = {%p", ws->s);
 	if (ws->f >= ws->s)
@@ -175,9 +175,9 @@ pan_ws(struct vsb *vsb, const struct ws *ws)
 		VSB_printf(vsb, ", +%ld", (long) (ws->e - ws->s));
 	else
 		VSB_printf(vsb, ", %p", ws->e);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -208,7 +208,7 @@ pan_htc(struct vsb *vsb, const struct http_conn *htc)
 	VSB_printf(vsb, "between_bytes_timeout = %f,\n",
 	    htc->between_bytes_timeout);
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -224,7 +224,7 @@ pan_http(struct vsb *vsb, const char *id, const struct http *h)
 	VSB_indent(vsb, 2);
 	PAN_CheckMagic(vsb, h, HTTP_MAGIC);
 	pan_ws(vsb, h->ws);
-	VSB_printf(vsb, "hdrs {\n");
+	VSB_cat(vsb, "hdrs {\n");
 	VSB_indent(vsb, 2);
 	for (i = 0; i < h->nhd; ++i) {
 		if (h->hd[i].b == NULL && h->hd[i].e == NULL)
@@ -233,9 +233,9 @@ pan_http(struct vsb *vsb, const char *id, const struct http *h)
 		    (int)(h->hd[i].e - h->hd[i].b), h->hd[i].b);
 	}
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -252,7 +252,7 @@ pan_boc(struct vsb *vsb, const struct boc *boc)
 	VSB_printf(vsb, "vary = %p,\n", boc->vary);
 	VSB_printf(vsb, "stevedore_priv = %p,\n", boc->stevedore_priv);
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -268,21 +268,21 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc)
 	VSB_indent(vsb, 2);
 	PAN_CheckMagic(vsb, oc, OBJCORE_MAGIC);
 	VSB_printf(vsb, "refcnt = %d,\n", oc->refcnt);
-	VSB_printf(vsb, "flags = {");
+	VSB_cat(vsb, "flags = {");
 
 /*lint -save -esym(438,p) -esym(838,p) -e539 */
 	p = "";
 #define OC_FLAG(U, l, v) \
 	if (oc->flags & v) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
 #include "tbl/oc_flags.h"
-	VSB_printf(vsb, "},\n");
-	VSB_printf(vsb, "exp_flags = {");
+	VSB_cat(vsb, "},\n");
+	VSB_cat(vsb, "exp_flags = {");
 	p = "";
 #define OC_EXP_FLAG(U, l, v) \
 	if (oc->exp_flags & v) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
 #include "tbl/oc_exp_flags.h"
 /*lint -restore */
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 
 	if (oc->boc != NULL)
 		pan_boc(vsb, oc->boc);
@@ -294,18 +294,18 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc)
 		VSB_printf(vsb, " (%s", oc->stobj->stevedore->name);
 		if (strlen(oc->stobj->stevedore->ident))
 			VSB_printf(vsb, " %s", oc->stobj->stevedore->ident);
-		VSB_printf(vsb, ")");
+		VSB_cat(vsb, ")");
 		if (oc->stobj->stevedore->panic) {
-			VSB_printf(vsb, " {\n");
+			VSB_cat(vsb, " {\n");
 			VSB_indent(vsb, 2);
 			oc->stobj->stevedore->panic(vsb, oc);
 			VSB_indent(vsb, -2);
-			VSB_printf(vsb, "}");
+			VSB_cat(vsb, "}");
 		}
 	}
-	VSB_printf(vsb, ",\n");
+	VSB_cat(vsb, ",\n");
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -325,13 +325,13 @@ pan_wrk(struct vsb *vsb, const struct worker *wrk)
 	pan_ws(vsb, wrk->aws);
 
 	m = wrk->cur_method;
-	VSB_printf(vsb, "VCL::method = ");
+	VSB_cat(vsb, "VCL::method = ");
 	if (m == 0) {
-		VSB_printf(vsb, "none,\n");
+		VSB_cat(vsb, "none,\n");
 		return;
 	}
 	if (!(m & 1))
-		VSB_printf(vsb, "inside ");
+		VSB_cat(vsb, "inside ");
 	m &= ~1;
 	hand = VCL_Method_Name(m);
 	if (hand != NULL)
@@ -344,7 +344,7 @@ pan_wrk(struct vsb *vsb, const struct worker *wrk)
 		VSB_printf(vsb, "VCL::return = %s,\n", hand);
 	else
 		VSB_printf(vsb, "VCL::return = 0x%x,\n", wrk->handling);
-	VSB_printf(vsb, "VCL::methods = {");
+	VSB_cat(vsb, "VCL::methods = {");
 	m = wrk->seen_methods;
 	p = "";
 	for (u = 1; m ; u <<= 1) {
@@ -354,9 +354,9 @@ pan_wrk(struct vsb *vsb, const struct worker *wrk)
 			p = ", ";
 		}
 	}
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 static void
@@ -374,7 +374,7 @@ pan_vfp(struct vsb *vsb, const struct vfp_ctx *vfc)
 	VSB_printf(vsb, "oc = %p,\n", vfc->oc);
 
 	if (!VTAILQ_EMPTY(&vfc->vfp)) {
-		VSB_printf(vsb, "filters = {\n");
+		VSB_cat(vsb, "filters = {\n");
 		VSB_indent(vsb, 2);
 		VTAILQ_FOREACH(vfe, &vfc->vfp, list) {
 			VSB_printf(vsb, "%s = %p {\n", vfe->vfp->name, vfe);
@@ -383,15 +383,15 @@ pan_vfp(struct vsb *vsb, const struct vfp_ctx *vfc)
 			VSB_printf(vsb, "priv2 = %zd,\n", vfe->priv2);
 			VSB_printf(vsb, "closed = %d\n", vfe->closed);
 			VSB_indent(vsb, -2);
-			VSB_printf(vsb, "},\n");
+			VSB_cat(vsb, "},\n");
 		}
 		VSB_indent(vsb, -2);
-		VSB_printf(vsb, "},\n");
+		VSB_cat(vsb, "},\n");
 	}
 
 	VSB_printf(vsb, "obj_flags = 0x%x,\n", vfc->obj_flags);
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 static void
@@ -406,17 +406,17 @@ pan_vdp(struct vsb *vsb, const struct vdp_ctx *vdc)
 	VSB_printf(vsb, "retval = %d,\n", vdc->retval);
 
 	if (!VTAILQ_EMPTY(&vdc->vdp)) {
-		VSB_printf(vsb, "filters = {\n");
+		VSB_cat(vsb, "filters = {\n");
 		VSB_indent(vsb, 2);
 		VTAILQ_FOREACH(vde, &vdc->vdp, list)
 			VSB_printf(vsb, "%s = %p { priv = %p }\n",
 			    vde->vdp->name, vde, vde->priv);
 		VSB_indent(vsb, -2);
-		VSB_printf(vsb, "},\n");
+		VSB_cat(vsb, "},\n");
 	}
 
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 static void
@@ -462,25 +462,25 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
 
 	// fetch_task left out
 
-	VSB_printf(vsb, "flags = {");
+	VSB_cat(vsb, "flags = {");
 	p = "";
 /*lint -save -esym(438,p) -e539 */
 #define BO_FLAG(l, r, w, d) \
 	if (bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
 #include "tbl/bo_flags.h"
 /*lint -restore */
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 
 	// timeouts/timers/acct/storage left out
 
 	VDI_Panic(bo->director_req, vsb, "director_req");
 	if (bo->director_resp == bo->director_req)
-		VSB_printf(vsb, "director_resp = director_req,\n");
+		VSB_cat(vsb, "director_resp = director_req,\n");
 	else
 		VDI_Panic(bo->director_resp, vsb, "director_resp");
 	VCL_Panic(vsb, "vcl", bo->vcl);
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -501,13 +501,13 @@ pan_req(struct vsb *vsb, const struct req *req)
 	    xp == NULL ? "NULL" : xp->name);
 
 	if (xp != NULL && xp->req_panic != NULL) {
-		VSB_printf(vsb, " {\n");
+		VSB_cat(vsb, " {\n");
 		VSB_indent(vsb, 2);
 		xp->req_panic(vsb, req);
 		VSB_indent(vsb, -2);
-		VSB_printf(vsb, "}");
+		VSB_cat(vsb, "}");
 	}
-	VSB_printf(vsb, "\n");
+	VSB_cat(vsb, "\n");
 	switch (req->req_step) {
 #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break;
 #include "tbl/steps.h"
@@ -552,23 +552,23 @@ pan_req(struct vsb *vsb, const struct req *req)
 	if (req->objcore != NULL)
 		pan_objcore(vsb, "REQ", req->objcore);
 
-	VSB_printf(vsb, "flags = {\n");
+	VSB_cat(vsb, "flags = {\n");
 	VSB_indent(vsb, 2);
 #define REQ_FLAG(l, r, w, d) if (req->l) VSB_printf(vsb, #l ",\n");
 #include "tbl/req_flags.h"
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 
 	pan_privs(vsb, req->privs);
 
-	VSB_printf(vsb, "topreq = {\n");
+	VSB_cat(vsb, "topreq = {\n");
 	VSB_indent(vsb, 2);
 	pan_req(vsb, req->topreq);
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -594,13 +594,13 @@ pan_sess(struct vsb *vsb, const struct sess *sp)
 	VSB_printf(vsb, "transport = %s",
 	    xp == NULL ? "<none>" : xp->name);
 	if (xp != NULL && xp->sess_panic != NULL) {
-		VSB_printf(vsb, " {\n");
+		VSB_cat(vsb, " {\n");
 		VSB_indent(vsb, 2);
 		xp->sess_panic(vsb, sp);
 		VSB_indent(vsb, -2);
-		VSB_printf(vsb, "}");
+		VSB_cat(vsb, "}");
 	}
-	VSB_printf(vsb, "\n");
+	VSB_cat(vsb, "\n");
 	ci = SES_Get_String_Attr(sp, SA_CLIENT_IP);
 	cp = SES_Get_String_Attr(sp, SA_CLIENT_PORT);
 	if (VALID_OBJ(sp->listen_sock, LISTEN_SOCK_MAGIC))
@@ -610,7 +610,7 @@ pan_sess(struct vsb *vsb, const struct sess *sp)
 		VSB_printf(vsb, "client = %s %s <unknown>\n", ci, cp);
 
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -626,7 +626,7 @@ pan_backtrace(struct vsb *vsb)
 	char fname[1024];
 	int ret;
 
-	VSB_printf(vsb, "Backtrace:\n");
+	VSB_cat(vsb, "Backtrace:\n");
 	VSB_indent(vsb, 2);
 
 	ret = unw_getcontext(&uc);
@@ -673,14 +673,14 @@ pan_backtrace(struct vsb *vsb)
 		VSB_printf(vsb, "Backtrace not available (ret=%zu)\n", size);
 		return;
 	}
-	VSB_printf(vsb, "Backtrace:\n");
+	VSB_cat(vsb, "Backtrace:\n");
 	VSB_indent(vsb, 2);
 	for (i = 0; i < size; i++) {
 		bprintf(buf, "%p", array[i]);
 		VSB_printf(vsb, "%s: ", buf);
 		strings = backtrace_symbols(&array[i], 1);
 		if (strings == NULL || strings[0] == NULL) {
-			VSB_printf(vsb, "(?)");
+			VSB_cat(vsb, "(?)");
 		} else {
 			p = strings[0];
 			if (!memcmp(buf, p, strlen(buf))) {
@@ -692,7 +692,7 @@ pan_backtrace(struct vsb *vsb)
 			}
 			VSB_printf(vsb, "%s", p);
 		}
-		VSB_printf (vsb, "\n");
+		VSB_cat(vsb, "\n");
 		free(strings);
 	}
 	VSB_indent(vsb, -2);
@@ -816,10 +816,9 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
 			VSL_Flush(bo->vsl, 0);
 		VMOD_Panic(pan_vsb);
 	} else {
-		VSB_printf(pan_vsb,
-		    "Feature short panic supressed details.\n");
+		VSB_cat(pan_vsb, "Feature short panic supressed details.\n");
 	}
-	VSB_printf(pan_vsb, "\n");
+	VSB_cat(pan_vsb, "\n");
 	VSB_putc(pan_vsb, '\0');	/* NUL termination */
 
 	if (FEATURE(FEATURE_NO_COREDUMP))
@@ -860,7 +859,7 @@ PAN_Init(void)
 	AN(heritage.panic_str_len);
 	AN(VSB_new(pan_vsb, heritage.panic_str, heritage.panic_str_len,
 	    VSB_FIXEDLEN));
-	VSB_printf(pan_vsb, "This is a test\n");
+	VSB_cat(pan_vsb, "This is a test\n");
 	AZ(VSB_finish(pan_vsb));
 	VSB_clear(pan_vsb);
 	heritage.panic_str[0] = '\0';
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index b0ee19899..f9072c068 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -222,24 +222,24 @@ VCL_Panic(struct vsb *vsb, const char *nm, const struct vcl *vcl)
 	VSB_printf(vsb, "discard = %u,\n", vcl->discard);
 	VSB_printf(vsb, "state = %s,\n", vcl->state);
 	VSB_printf(vsb, "temp = %s,\n", (const volatile char *)vcl->temp);
-	VSB_printf(vsb, "conf = {\n");
+	VSB_cat(vsb, "conf = {\n");
 	VSB_indent(vsb, 2);
 	if (vcl->conf == NULL) {
-		VSB_printf(vsb, "conf = NULL\n");
+		VSB_cat(vsb, "conf = NULL\n");
 	} else {
 		PAN_CheckMagic(vsb, vcl->conf, VCL_CONF_MAGIC);
 		VSB_printf(vsb, "syntax = \"%u\",\n", vcl->conf->syntax);
-		VSB_printf(vsb, "srcname = {\n");
+		VSB_cat(vsb, "srcname = {\n");
 		VSB_indent(vsb, 2);
 		for (i = 0; i < vcl->conf->nsrc; ++i)
 			VSB_printf(vsb, "\"%s\",\n", vcl->conf->srcname[i]);
 		VSB_indent(vsb, -2);
-		VSB_printf(vsb, "},\n");
+		VSB_cat(vsb, "},\n");
 	}
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*--------------------------------------------------------------------*/
@@ -388,18 +388,18 @@ VCL_Open(const char *fn, struct vsb *msg)
 #endif
 	dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL);
 	if (dlh == NULL) {
-		VSB_printf(msg, "Could not load compiled VCL.\n");
+		VSB_cat(msg, "Could not load compiled VCL.\n");
 		VSB_printf(msg, "\tdlopen() = %s\n", dlerror());
 		return (NULL);
 	}
 	cnf = dlsym(dlh, "VCL_conf");
 	if (cnf == NULL) {
-		VSB_printf(msg, "Compiled VCL lacks metadata.\n");
+		VSB_cat(msg, "Compiled VCL lacks metadata.\n");
 		(void)dlclose(dlh);
 		return (NULL);
 	}
 	if (cnf->magic != VCL_CONF_MAGIC) {
-		VSB_printf(msg, "Compiled VCL has mangled metadata.\n");
+		VSB_cat(msg, "Compiled VCL has mangled metadata.\n");
 		(void)dlclose(dlh);
 		return (NULL);
 	}
diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index c2c46d4a9..d8694ccdd 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -78,7 +78,7 @@ pan_privs(struct vsb *vsb, const struct vrt_privs *privs)
 		}
 	}
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 
diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index bfc9496c5..c760606bc 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -118,7 +118,7 @@ VPI_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
 		    strcmp(d->file_id, file_id)) {
 			VSB_printf(ctx->msg, "Loading vmod %s from %s (%s):\n",
 			    nm, backup, path);
-			VSB_printf(ctx->msg,
+			VSB_cat(ctx->msg,
 			    "This is no longer the same file seen by"
 			    " the VCL-compiler.\n");
 			(void)dlclose(v->hdl);
@@ -134,7 +134,7 @@ VPI_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
 		    d->json == NULL) {
 			VSB_printf(ctx->msg, "Loading vmod %s from %s (%s):\n",
 			    nm, backup, path);
-			VSB_printf(ctx->msg, "VMOD data is mangled.\n");
+			VSB_cat(ctx->msg, "VMOD data is mangled.\n");
 			(void)dlclose(v->hdl);
 			FREE_OBJ(v);
 			return (1);
@@ -197,13 +197,13 @@ VMOD_Panic(struct vsb *vsb)
 {
 	struct vmod *v;
 
-	VSB_printf(vsb, "vmods = {\n");
+	VSB_cat(vsb, "vmods = {\n");
 	VSB_indent(vsb, 2);
 	VTAILQ_FOREACH(v, &vmods, list)
 		VSB_printf(vsb, "%s = {%p, %s, %u.%u},\n",
 		    v->nm, v, v->abi, v->vrt_major, v->vrt_minor);
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "},\n");
+	VSB_cat(vsb, "},\n");
 }
 
 /*---------------------------------------------------------------------*/
diff --git a/bin/varnishd/http2/cache_http2_panic.c b/bin/varnishd/http2/cache_http2_panic.c
index 9e80eb67b..122e43d83 100644
--- a/bin/varnishd/http2/cache_http2_panic.c
+++ b/bin/varnishd/http2/cache_http2_panic.c
@@ -45,7 +45,7 @@ h2_sess_panic(struct vsb *vsb, const struct sess *sp)
 
 	h2 = (void*)*up;
 	CHECK_OBJ_NOTNULL(h2, H2_SESS_MAGIC);
-	VSB_printf(vsb, "streams {\n");
+	VSB_cat(vsb, "streams {\n");
 	VSB_indent(vsb, 2);
 	VTAILQ_FOREACH(r2, &h2->streams, list) {
 		PAN_CheckMagic(vsb, r2, H2_REQ_MAGIC);
@@ -57,8 +57,8 @@ h2_sess_panic(struct vsb *vsb, const struct sess *sp)
 			VSB_printf(vsb, " State %d", r2->state);
 			break;
 		}
-		VSB_printf(vsb, "\n");
+		VSB_cat(vsb, "\n");
 	}
 	VSB_indent(vsb, -2);
-	VSB_printf(vsb, "}\n");
+	VSB_cat(vsb, "}\n");
 }
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index b28a26953..ca6037706 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -541,7 +541,7 @@ mgt_reap_child(void)
 	}
 #ifdef WCOREDUMP
 	if (WCOREDUMP(status)) {
-		VSB_printf(vsb, " (core dumped)");
+		VSB_cat(vsb, " (core dumped)");
 		exit_status |= 0x80;
 		VSC_C_mgt->child_dump++;
 	}
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 02b9c7ed0..b4407db14 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -590,15 +590,15 @@ main(int argc, char * const *argv)
 			REPLACE(fa->farg, "<-b argument>");
 			vsb = VSB_new_auto();
 			AN(vsb);
-			VSB_printf(vsb, "vcl 4.1;\n");
-			VSB_printf(vsb, "backend default {\n");
+			VSB_cat(vsb, "vcl 4.1;\n");
+			VSB_cat(vsb, "backend default {\n");
 			if (*optarg != '/')
 				VSB_printf(vsb, "    .host = \"%s\";\n",
 					   optarg);
 			else
 				VSB_printf(vsb, "    .path = \"%s\";\n",
 					   optarg);
-			VSB_printf(vsb, "}\n");
+			VSB_cat(vsb, "}\n");
 			AZ(VSB_finish(vsb));
 			fa->src = strdup(VSB_data(vsb));
 			AN(fa->src);
@@ -710,8 +710,8 @@ main(int argc, char * const *argv)
 			if (getenv("TMPDIR") != NULL)
 				VSB_printf(vsb, "%s", getenv("TMPDIR"));
 			else
-				VSB_printf(vsb, "/tmp");
-			VSB_printf(vsb, "/varnishd_C_XXXXXXX");
+				VSB_cat(vsb, "/tmp");
+			VSB_cat(vsb, "/varnishd_C_XXXXXXX");
 			AZ(VSB_finish(vsb));
 			Cn_arg = strdup(VSB_data(vsb));
 			AN(Cn_arg);
diff --git a/bin/varnishd/mgt/mgt_param_bits.c b/bin/varnishd/mgt/mgt_param_bits.c
index df2ca2320..279994a73 100644
--- a/bin/varnishd/mgt/mgt_param_bits.c
+++ b/bin/varnishd/mgt/mgt_param_bits.c
@@ -151,7 +151,7 @@ tweak_vsl_mask(struct vsb *vsb, const struct parspec *par, const char *arg)
 			}
 		}
 		if (*s == '\0')
-			VSB_printf(vsb, "(all enabled)");
+			VSB_cat(vsb, "(all enabled)");
 		if (arg == JSON_FMT)
 			VSB_putc(vsb, '"');
 	}
@@ -194,7 +194,7 @@ tweak_debug(struct vsb *vsb, const struct parspec *par, const char *arg)
 			}
 		}
 		if (*s == '\0')
-			VSB_printf(vsb, "none");
+			VSB_cat(vsb, "none");
 		if (arg == JSON_FMT)
 			VSB_putc(vsb, '"');
 	}
@@ -238,7 +238,7 @@ tweak_feature(struct vsb *vsb, const struct parspec *par, const char *arg)
 			}
 		}
 		if (*s == '\0')
-			VSB_printf(vsb, "none");
+			VSB_cat(vsb, "none");
 		if (arg == JSON_FMT)
 			VSB_putc(vsb, '"');
 	}
diff --git a/bin/varnishd/mgt/mgt_param_tweak.c b/bin/varnishd/mgt/mgt_param_tweak.c
index 30e58e2fc..78f95d3ff 100644
--- a/bin/varnishd/mgt/mgt_param_tweak.c
+++ b/bin/varnishd/mgt/mgt_param_tweak.c
@@ -143,7 +143,7 @@ tweak_bool(struct vsb *vsb, const struct parspec *par, const char *arg)
 		else if (!strcasecmp(arg, "true"))
 			*dest = 1;
 		else {
-			VSB_printf(vsb, "use \"on\" or \"off\"\n");
+			VSB_cat(vsb, "use \"on\" or \"off\"\n");
 			return (-1);
 		}
 	} else if (arg == JSON_FMT) {
@@ -207,7 +207,7 @@ tweak_generic_uint(struct vsb *vsb, volatile unsigned *dest, const char *arg,
 		}
 		*dest = u;
 	} else if (*dest == UINT_MAX && arg != JSON_FMT) {
-		VSB_printf(vsb, "unlimited");
+		VSB_cat(vsb, "unlimited");
 	} else {
 		VSB_printf(vsb, "%u", *dest);
 	}
@@ -248,7 +248,7 @@ fmt_bytes(struct vsb *vsb, uintmax_t t)
 			return;
 		}
 	}
-	VSB_printf(vsb, "(bogus number)");
+	VSB_cat(vsb, "(bogus number)");
 }
 
 static int
@@ -275,21 +275,19 @@ tweak_generic_bytes(struct vsb *vsb, volatile ssize_t *dest, const char *arg,
 		}
 		p = VNUM_2bytes(arg, &r, 0);
 		if (p != NULL) {
-			VSB_printf(vsb, "Could not convert to bytes.\n");
+			VSB_cat(vsb, "Could not convert to bytes.\n");
 			VSB_printf(vsb, "%s\n", p);
-			VSB_printf(vsb,
-			    "  Try something like '80k' or '120M'\n");
+			VSB_cat(vsb, "  Try something like '80k' or '120M'\n");
 			return (-1);
 		}
 		if ((uintmax_t)((ssize_t)r) != r) {
 			fmt_bytes(vsb, r);
-			VSB_printf(vsb,
-			    " is too large for this architecture.\n");
+			VSB_cat(vsb, " is too large for this architecture.\n");
 			return (-1);
 		}
 		if (max != NULL && r > rmax) {
 			VSB_printf(vsb, "Must be no more than %s\n", max);
-			VSB_printf(vsb, "\n");
+			VSB_cat(vsb, "\n");
 			return (-1);
 		}
 		if (min != NULL && r < rmin) {
@@ -396,13 +394,13 @@ tweak_poolparam(struct vsb *vsb, const struct parspec *par, const char *arg)
 
 	pp = par->priv;
 	if (arg == JSON_FMT) {
-		VSB_printf(vsb, "{\n");
+		VSB_cat(vsb, "{\n");
 		VSB_indent(vsb, 8);
 		VSB_printf(vsb, "\"min_pool\": %u,\n", pp->min_pool);
 		VSB_printf(vsb, "\"max_pool\": %u,\n", pp->max_pool);
 		VSB_printf(vsb, "\"max_age\": %g\n", pp->max_age);
 		VSB_indent(vsb, -4);
-		VSB_printf(vsb, "}");
+		VSB_cat(vsb, "}");
 	} else if (arg == NULL) {
 		VSB_printf(vsb, "%u,%u,%g",
 		    pp->min_pool, pp->max_pool, pp->max_age);
@@ -415,7 +413,7 @@ tweak_poolparam(struct vsb *vsb, const struct parspec *par, const char *arg)
 				break;
 			}
 			if (av[1] == NULL || av[2] == NULL || av[3] == NULL) {
-				VSB_printf(vsb,
+				VSB_cat(vsb,
 				    "Three fields required:"
 				    " min_pool, max_pool and max_age\n");
 				retval = -1;
@@ -437,7 +435,7 @@ tweak_poolparam(struct vsb *vsb, const struct parspec *par, const char *arg)
 			if (retval)
 				break;
 			if (px.min_pool > px.max_pool) {
-				VSB_printf(vsb,
+				VSB_cat(vsb,
 				    "min_pool cannot be larger"
 				    " than max_pool\n");
 				retval = -1;
diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index 58b4ec152..a8997b32e 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -237,11 +237,11 @@ mgt_vcc_compile(struct vcc_priv *vp, struct vsb *sb, int C_flag)
 		VSB_cat(sb, csrc);
 		free(csrc);
 
-		VSB_printf(sb, "/* EXTERNAL SYMBOL TABLE\n");
+		VSB_cat(sb, "/* EXTERNAL SYMBOL TABLE\n");
 		csrc = VFIL_readfile(NULL, VSB_data(vp->symfile), NULL);
 		AN(csrc);
 		VSB_cat(sb, csrc);
-		VSB_printf(sb, "*/\n");
+		VSB_cat(sb, "*/\n");
 		free(csrc);
 	}
 
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index ee9c19601..bb142f568 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -618,9 +618,9 @@ VPX_Send_Proxy(int fd, int version, const struct sess *sp)
 		AN(p2);
 		VTCP_name(sas, ha, sizeof ha, pa, sizeof pa);
 		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 ");
 		VSB_printf(vsb, "%s %s %s %s\r\n", p1, ha, p2, pa);
 	} else if (version == 2) {
 		AZ(SES_Get_client_addr(sp, &sac));
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index f0e26e2f4..2adf50d02 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -525,9 +525,9 @@ VSB_quote_pfx(struct vsb *s, const char *pfx, const void *v, int len, int how)
 		for (w = u; w < u + len; w++)
 			if (*w != 0x00)
 				break;
-		VSB_printf(s, "0x");
+		VSB_cat(s, "0x");
 		if (w == u + len && len > 4) {
-			VSB_printf(s, "0...0");
+			VSB_cat(s, "0...0");
 		} else {
 			for (w = u; w < u + len; w++)
 				VSB_printf(s, "%02x", *w);
diff --git a/lib/libvarnish/vsub.c b/lib/libvarnish/vsub.c
index 3a497c9c4..515169d82 100644
--- a/lib/libvarnish/vsub.c
+++ b/lib/libvarnish/vsub.c
@@ -178,8 +178,8 @@ VSUB_run(struct vsb *sb, vsub_func_f *func, void *priv, const char *name,
 			VSB_printf(sb, ", signal %d", WTERMSIG(status));
 		}
 		if (WCOREDUMP(status))
-			VSB_printf(sb, ", core dumped");
-		VSB_printf(sb, "\n");
+			VSB_cat(sb, ", core dumped");
+		VSB_cat(sb, "\n");
 		assert(rv != -1);
 		return (rv);
 	}
diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c
index 5c5049827..4b23a8882 100644
--- a/lib/libvarnishapi/vxp.c
+++ b/lib/libvarnishapi/vxp.c
@@ -50,7 +50,7 @@ vxp_ErrToken(const struct vxp *vxp, const struct token *t)
 {
 
 	if (t->tok == EOI)
-		VSB_printf(vxp->sb, "end of input");
+		VSB_cat(vxp->sb, "end of input");
 	else
 		VSB_printf(vxp->sb, "'%.*s'", PF(t));
 }
@@ -120,7 +120,7 @@ vxp_NextToken(struct vxp *vxp)
 	AN(vxp->t);
 	vxp->t = VTAILQ_NEXT(vxp->t, list);
 	if (vxp->t == NULL) {
-		VSB_printf(vxp->sb,
+		VSB_cat(vxp->sb,
 		    "Ran out of input, something is missing or"
 		    " maybe unbalanced parenthesis\n");
 		vxp->err = 1;
diff --git a/lib/libvarnishapi/vxp_lexer.c b/lib/libvarnishapi/vxp_lexer.c
index b1e952a12..49a8dfed4 100644
--- a/lib/libvarnishapi/vxp_lexer.c
+++ b/lib/libvarnishapi/vxp_lexer.c
@@ -145,7 +145,7 @@ vxp_Lexer(struct vxp *vxp)
 			}
 			vxp_append_token(vxp, VAL, p, q);
 			if (quote != '\0') {
-				VSB_printf(vxp->sb, "Unterminated string ");
+				VSB_cat(vxp->sb, "Unterminated string ");
 				vxp_ErrWhere(vxp, vxp->t, q - p);
 				return;
 			}
@@ -177,7 +177,7 @@ vxp_Lexer(struct vxp *vxp)
 
 		/* Error */
 		vxp_append_token(vxp, EOI, p, p + 1);
-		VSB_printf(vxp->sb, "Syntax error ");
+		VSB_cat(vxp->sb, "Syntax error ");
 		vxp_ErrWhere(vxp, vxp->t, q - p);
 		return;
 	}
diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c
index 16f65f42f..b11e8dd50 100644
--- a/lib/libvarnishapi/vxp_parse.c
+++ b/lib/libvarnishapi/vxp_parse.c
@@ -86,7 +86,7 @@ vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs)
 		}
 		(*plhs)->level = (int)strtol(vxp->t->dec, &p, 0);
 		if ((*plhs)->level < 0) {
-			VSB_printf(vxp->sb, "Expected positive integer ");
+			VSB_cat(vxp->sb, "Expected positive integer ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
@@ -98,7 +98,7 @@ vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs)
 			p++;
 		}
 		if (*p) {
-			VSB_printf(vxp->sb, "Syntax error in level limit ");
+			VSB_cat(vxp->sb, "Syntax error in level limit ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
@@ -123,17 +123,17 @@ vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs)
 			    (*plhs)->tags);
 		}
 		if (i == -1) {
-			VSB_printf(vxp->sb, "Tag name matches zero tags ");
+			VSB_cat(vxp->sb, "Tag name matches zero tags ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
 		if (i == -2) {
-			VSB_printf(vxp->sb, "Tag name is ambiguous ");
+			VSB_cat(vxp->sb, "Tag name is ambiguous ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
 		if (i == -3) {
-			VSB_printf(vxp->sb, "Syntax error in tag name ");
+			VSB_cat(vxp->sb, "Syntax error in tag name ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
@@ -171,7 +171,7 @@ vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs)
 		}
 		(*plhs)->field = (int)strtol(vxp->t->dec, &p, 0);
 		if (*p || (*plhs)->field <= 0) {
-			VSB_printf(vxp->sb, "Expected positive integer ");
+			VSB_cat(vxp->sb, "Expected positive integer ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
@@ -186,7 +186,7 @@ vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs)
 	if ((*plhs)->vxid > 1 || (*plhs)->level >= 0 ||
 	    (*plhs)->field > 0 || (*plhs)->prefixlen > 0 ||
 	    (*plhs)->taglist > 0) {
-		VSB_printf(vxp->sb, "Unexpected taglist selection for vxid ");
+		VSB_cat(vxp->sb, "Unexpected taglist selection for vxid ");
 		vxp_ErrWhere(vxp, vxp->t, -1);
 	}
 }
@@ -210,7 +210,7 @@ vxp_expr_num(struct vxp *vxp, struct vex_rhs **prhs, unsigned vxid)
 		(*prhs)->type = VEX_FLOAT;
 		(*prhs)->val_float = VNUM(vxp->t->dec);
 		if (isnan((*prhs)->val_float)) {
-			VSB_printf(vxp->sb, "Floating point parse error ");
+			VSB_cat(vxp->sb, "Floating point parse error ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
@@ -220,7 +220,7 @@ vxp_expr_num(struct vxp *vxp, struct vex_rhs **prhs, unsigned vxid)
 		while (isspace(*endptr))
 			endptr++;
 		if (*endptr != '\0') {
-			VSB_printf(vxp->sb, "Integer parse error ");
+			VSB_cat(vxp->sb, "Integer parse error ");
 			vxp_ErrWhere(vxp, vxp->t, -1);
 			return;
 		}
diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index 023a73d52..da3f282d1 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -135,9 +135,9 @@ vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
 			 */
 			if (aen->not == ae2->not)
 				return;
-			VSB_printf(tl->sb, "Conflicting ACL entries:\n");
+			VSB_cat(tl->sb, "Conflicting ACL entries:\n");
 			vcc_ErrWhere(tl, ae2->t_addr);
-			VSB_printf(tl->sb, "vs:\n");
+			VSB_cat(tl->sb, "vs:\n");
 			vcc_ErrWhere(tl, aen->t_addr);
 			return;
 		}
@@ -311,13 +311,13 @@ vcc_acl_entry(struct vcc *tl)
 		e = NULL;
 		ae->mask = strtoul(sl, &e, 10);
 		if (*e != '\0') {
-			VSB_printf(tl->sb, ".../mask is not numeric.\n");
+			VSB_cat(tl->sb, ".../mask is not numeric.\n");
 			vcc_ErrWhere(tl, ae->t_addr);
 			return;
 		}
 		ae->t_mask = ae->t_addr;
 		if (tl->t->tok == '/') {
-			VSB_printf(tl->sb, "/mask only allowed once.\n");
+			VSB_cat(tl->sb, "/mask only allowed once.\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
 		}
diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index c243dbcb7..a8f3ca20a 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -273,11 +273,11 @@ vcc_act_return_vcl(struct vcc *tl)
 	ERRCHK(tl);
 	AN(sym);
 	if (sym->eval_priv == NULL) {
-		VSB_printf(tl->symtab, ",\n    {\n");
-		VSB_printf(tl->symtab, "\t\"dir\": \"import\",\n");
-		VSB_printf(tl->symtab, "\t\"type\": \"$VCL\",\n");
+		VSB_cat(tl->symtab, ",\n    {\n");
+		VSB_cat(tl->symtab, "\t\"dir\": \"import\",\n");
+		VSB_cat(tl->symtab, "\t\"type\": \"$VCL\",\n");
 		VSB_printf(tl->symtab, "\t\"name\": \"%s\"\n", sym->name);
-		VSB_printf(tl->symtab, "   }");
+		VSB_cat(tl->symtab, "   }");
 
 		bprintf(buf, "vgc_vcl_%u", tl->unique++);
 		sym->eval_priv = strdup(buf);
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index b943cf5fd..c8f5ee8cd 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -41,9 +41,9 @@ vcc_default_probe(struct vcc *tl)
 
 	if (tl->default_probe != NULL)
 		return (tl->default_probe);
-	VSB_printf(tl->sb, "No default probe defined\n");
+	VSB_cat(tl->sb, "No default probe defined\n");
 	vcc_ErrToken(tl, tl->t);
-	VSB_printf(tl->sb, " at\n");
+	VSB_cat(tl->sb, " at\n");
 	vcc_ErrWhere(tl, tl->t);
 	return ("");
 }
@@ -95,7 +95,7 @@ vcc_Redef(struct vcc *tl, const char *redef, struct token **t_did,
 	if (*t_did != NULL) {
 		VSB_printf(tl->sb, "%s redefinition at:\n", redef);
 		vcc_ErrWhere(tl, t_field);
-		VSB_printf(tl->sb, "Previous definition:\n");
+		VSB_cat(tl->sb, "Previous definition:\n");
 		vcc_ErrWhere(tl, *t_did);
 		return;
 	}
@@ -195,7 +195,7 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **name)
 		} else if (vcc_IdIs(t_field, "expected_response")) {
 			status = vcc_UintVal(tl);
 			if (status < 100 || status > 999) {
-				VSB_printf(tl->sb,
+				VSB_cat(tl->sb,
 				    "Must specify .expected_response with "
 				    "exactly three digits "
 				    "(100 <= x <= 999)\n");
@@ -219,13 +219,13 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **name)
 
 	if (t_threshold != NULL || t_window != NULL) {
 		if (t_threshold == NULL && t_window != NULL) {
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "Must specify .threshold with .window\n");
 			vcc_ErrWhere(tl, t_window);
 			return;
 		} else if (t_threshold != NULL && t_window == NULL) {
 			if (threshold > 64) {
-				VSB_printf(tl->sb,
+				VSB_cat(tl->sb,
 				    "Threshold must be 64 or less.\n");
 				vcc_ErrWhere(tl, t_threshold);
 				return;
@@ -233,12 +233,12 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **name)
 			window = threshold + 1;
 		} else if (window > 64) {
 			AN(t_window);
-			VSB_printf(tl->sb, "Window must be 64 or less.\n");
+			VSB_cat(tl->sb, "Window must be 64 or less.\n");
 			vcc_ErrWhere(tl, t_window);
 			return;
 		}
 		if (threshold > window ) {
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "Threshold can not be greater than window.\n");
 			AN(t_threshold);
 			vcc_ErrWhere(tl, t_threshold);
@@ -344,12 +344,12 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
 
 	/* Check for old syntax */
 	if (tl->t->tok == ID && vcc_IdIs(tl->t, "set")) {
-		VSB_printf(tl->sb,
+		VSB_cat(tl->sb,
 		    "NB: Backend Syntax has changed:\n"
 		    "Remove \"set\" and \"backend\" in front"
 		    " of backend fields.\n" );
 		vcc_ErrToken(tl, tl->t);
-		VSB_printf(tl->sb, " at ");
+		VSB_cat(tl->sb, " at ");
 		vcc_ErrWhere(tl, tl->t);
 		return;
 	}
@@ -374,11 +374,11 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
 			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "path")) {
 			if (tl->syntax < VCL_41) {
-				VSB_printf(tl->sb,
+				VSB_cat(tl->sb,
 				    "Unix socket backends only supported"
 				    " in VCL4.1 and higher.\n");
 				vcc_ErrToken(tl, tl->t);
-				VSB_printf(tl->sb, " at ");
+				VSB_cat(tl->sb, " at ");
 				vcc_ErrWhere(tl, tl->t);
 				return;
 			}
@@ -423,7 +423,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
 			u = vcc_UintVal(tl);
 			ERRCHK(tl);
 			if (u != 1 && u != 2) {
-				VSB_printf(tl->sb,
+				VSB_cat(tl->sb,
 				    ".proxy_header must be 1 or 2\n");
 				vcc_ErrWhere(tl, t_val);
 				return;
@@ -447,10 +447,9 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
 			}
 			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "probe")) {
-			VSB_printf(tl->sb,
-			    "Expected '{' or name of probe, got ");
+			VSB_cat(tl->sb, "Expected '{' or name of probe, got ");
 			vcc_ErrToken(tl, tl->t);
-			VSB_printf(tl->sb, " at\n");
+			VSB_cat(tl->sb, " at\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
 		} else {
@@ -464,7 +463,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
 	ERRCHK(tl);
 
 	if (t_host == NULL && t_path == NULL) {
-		VSB_printf(tl->sb, "Expected .host or .path.\n");
+		VSB_cat(tl->sb, "Expected .host or .path.\n");
 		vcc_ErrWhere(tl, t_be);
 		return;
 	}
@@ -537,7 +536,7 @@ vcc_ParseBackend(struct vcc *tl)
 			tl->default_director = NULL;
 		}
 		if (tl->default_director != NULL) {
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "Only one default director possible.\n");
 			vcc_ErrWhere(tl, t_first);
 			return;
@@ -573,8 +572,8 @@ vcc_Backend_Init(struct vcc *tl)
 
 	Fh(tl, 0, "\nstatic struct vsmw_cluster *vsc_cluster;\n");
 	ifp = New_IniFin(tl);
-	VSB_printf(ifp->ini, "\tvsc_cluster = VRT_VSM_Cluster_New(ctx,\n"
+	VSB_cat(ifp->ini, "\tvsc_cluster = VRT_VSM_Cluster_New(ctx,\n"
 	    "\t    ndirector * VRT_backend_vsm_need(ctx));\n");
-	VSB_printf(ifp->ini, "\tif (vsc_cluster == 0)\n\t\treturn(1);");
-	VSB_printf(ifp->fin, "\t\tVRT_VSM_Cluster_Destroy(ctx, &vsc_cluster);");
+	VSB_cat(ifp->ini, "\tif (vsc_cluster == 0)\n\t\treturn(1);");
+	VSB_cat(ifp->fin, "\t\tVRT_VSM_Cluster_Destroy(ctx, &vsc_cluster);");
 }
diff --git a/lib/libvcc/vcc_backend_util.c b/lib/libvcc/vcc_backend_util.c
index 757026e89..e7c68edfc 100644
--- a/lib/libvcc/vcc_backend_util.c
+++ b/lib/libvcc/vcc_backend_util.c
@@ -104,17 +104,17 @@ vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs)
 			fs->found = t_field;
 			return;
 		}
-		VSB_printf(tl->sb, "Field ");
+		VSB_cat(tl->sb, "Field ");
 		vcc_ErrToken(tl, t_field);
-		VSB_printf(tl->sb, " redefined at:\n");
+		VSB_cat(tl->sb, " redefined at:\n");
 		vcc_ErrWhere(tl, t_field);
-		VSB_printf(tl->sb, "\nFirst defined at:\n");
+		VSB_cat(tl->sb, "\nFirst defined at:\n");
 		vcc_ErrWhere(tl, fs->found);
 		return;
 	}
-	VSB_printf(tl->sb, "Unknown field: ");
+	VSB_cat(tl->sb, "Unknown field: ");
 	vcc_ErrToken(tl, t_field);
-	VSB_printf(tl->sb, " at\n");
+	VSB_cat(tl->sb, " at\n");
 	vcc_ErrWhere(tl, t_field);
 }
 
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index cfbc62c2e..4d83b490a 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -243,33 +243,33 @@ EmitCoordinates(const struct vcc *tl, struct vsb *vsb)
 	struct source *sp;
 	const char *p;
 
-	VSB_printf(vsb, "/* ---===### Source Code ###===---*/\n");
+	VSB_cat(vsb, "/* ---===### Source Code ###===---*/\n");
 
 	VSB_printf(vsb, "\n#define VGC_NSRCS %u\n", tl->nsources);
 
-	VSB_printf(vsb, "\nstatic const char *srcname[VGC_NSRCS] = {\n");
+	VSB_cat(vsb, "\nstatic const char *srcname[VGC_NSRCS] = {\n");
 	VTAILQ_FOREACH(sp, &tl->sources, list) {
-		VSB_printf(vsb, "\t");
+		VSB_cat(vsb, "\t");
 		VSB_quote(vsb, sp->name, -1, VSB_QUOTE_CSTR);
-		VSB_printf(vsb, ",\n");
+		VSB_cat(vsb, ",\n");
 	}
-	VSB_printf(vsb, "};\n");
+	VSB_cat(vsb, "};\n");
 
 	VSB_printf(vsb, "\nstatic const char *srcbody[%u] = {\n", tl->nsources);
 	VTAILQ_FOREACH(sp, &tl->sources, list) {
-		VSB_printf(vsb, "    /* ");
+		VSB_cat(vsb, "    /* ");
 		VSB_quote(vsb, sp->name, -1, VSB_QUOTE_CSTR);
-		VSB_printf(vsb, " */\n");
+		VSB_cat(vsb, " */\n");
 		VSB_quote_pfx(vsb, "\t", sp->b, sp->e - sp->b, VSB_QUOTE_CSTR);
-		VSB_printf(vsb, ",\n");
+		VSB_cat(vsb, ",\n");
 	}
-	VSB_printf(vsb, "};\n\n");
+	VSB_cat(vsb, "};\n\n");
 
-	VSB_printf(vsb, "/* ---===### Location Counters ###===---*/\n");
+	VSB_cat(vsb, "/* ---===### Location Counters ###===---*/\n");
 
 	VSB_printf(vsb, "\n#define VGC_NREFS %u\n\n", tl->cnt + 1);
 
-	VSB_printf(vsb, "static const struct vpi_ref VGC_ref[VGC_NREFS] = {\n");
+	VSB_cat(vsb, "static const struct vpi_ref VGC_ref[VGC_NREFS] = {\n");
 	lin = 1;
 	pos = 0;
 	sp = 0;
@@ -300,11 +300,11 @@ EmitCoordinates(const struct vcc *tl, struct vsb *vsb)
 		VSB_printf(vsb, "  [%3u] = { %u, %8tu, %4u, %3u, ",
 		    t->cnt, sp->idx, t->b - sp->b, lin, pos + 1);
 		if (t->tok == CSRC)
-			VSB_printf(vsb, " \"C{\"},\n");
+			VSB_cat(vsb, " \"C{\"},\n");
 		else
 			VSB_printf(vsb, " \"%.*s\" },\n", PF(t));
 	}
-	VSB_printf(vsb, "};\n\n");
+	VSB_cat(vsb, "};\n\n");
 }
 
 /*--------------------------------------------------------------------
@@ -551,7 +551,7 @@ vcc_resolve_includes(struct vcc *tl)
 		t1 = VTAILQ_NEXT(t, list);
 		AN(t1);			/* There's always an EOI */
 		if (t1->tok != CSTR) {
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "include not followed by string constant.\n");
 			vcc_ErrWhere(tl, t1);
 			return;
@@ -560,7 +560,7 @@ vcc_resolve_includes(struct vcc *tl)
 		AN(t2);			/* There's always an EOI */
 
 		if (t2->tok != ';') {
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "include <string> not followed by semicolon.\n");
 			vcc_ErrWhere(tl, t1);
 			return;
@@ -573,7 +573,7 @@ vcc_resolve_includes(struct vcc *tl)
 			 * the include directive.
 			 */
 			if (t1->src->name[0] != '/') {
-				VSB_printf(tl->sb,
+				VSB_cat(tl->sb,
 				    "include \"./xxxxx\"; needs absolute "
 				    "filename of including file.\n");
 				vcc_ErrWhere(tl, t1);
@@ -671,7 +671,7 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
 
 	/* Check if we have any backends at all */
 	if (tl->default_director == NULL) {
-		VSB_printf(tl->sb,
+		VSB_cat(tl->sb,
 		    "No backends or directors found in VCL program, "
 		    "at least one is necessary.\n");
 		tl->err = 1;
@@ -692,13 +692,13 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
 
 	/* Tie vcl_init/fini in */
 	ifp = New_IniFin(tl);
-	VSB_printf(ifp->ini, "\tVGC_function_vcl_init(ctx);\n");
+	VSB_cat(ifp->ini, "\tVGC_function_vcl_init(ctx);\n");
 	/*
 	 * Because the failure could be half way into vcl_init{} so vcl_fini{}
 	 * must always be called, also on failure.
 	 */
 	ifp->ignore_errors = 1;
-	VSB_printf(ifp->fin, "\t\tVGC_function_vcl_fini(ctx);");
+	VSB_cat(ifp->fin, "\t\tVGC_function_vcl_fini(ctx);");
 
 	/* Emit method functions */
 	Fh(tl, 1, "\n");
@@ -715,7 +715,7 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
 
 	VCC_XrefTable(tl);
 
-	VSB_printf(tl->symtab, "\n]\n");
+	VSB_cat(tl->symtab, "\n]\n");
 	AZ(VSB_finish(tl->symtab));
 	if (TLWriteVSB(tl, jfile, tl->symtab, "Symbol table"))
 		return (NULL);
@@ -815,7 +815,7 @@ VCC_New(void)
 
 	tl->symtab = VSB_new_auto();
 	assert(tl->symtab != NULL);
-	VSB_printf(tl->symtab, "[\n    {\"version\": 0}");
+	VSB_cat(tl->symtab, "[\n    {\"version\": 0}");
 
 	tl->fc = VSB_new_auto();
 	assert(tl->fc != NULL);
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 29d82a23d..d7c32a8dc 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -290,7 +290,7 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 		(*e)->nstr = 1;
 	} else {
 		if ((*e)->fmt == BLOB)
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "Wrong use of BLOB value.\n"
 			    "BLOBs can only be used as arguments to VMOD"
 			    " functions.\n");
@@ -436,8 +436,8 @@ vcc_do_arg(struct vcc *tl, struct func_arg *fa)
 			if (vcc_IdIs(tl->t, vv->value))
 				break;
 		if (vv == NULL) {
-			VSB_printf(tl->sb, "Wrong enum value.");
-			VSB_printf(tl->sb, "  Expected one of:\n");
+			VSB_cat(tl->sb, "Wrong enum value.");
+			VSB_cat(tl->sb, "  Expected one of:\n");
 			VTAILQ_FOREACH(vv, &fa->enums->children, list)
 				VSB_printf(tl->sb, "\t%s\n", vv->value);
 			vcc_ErrWhere(tl, tl->t);
@@ -626,7 +626,7 @@ vcc_Eval_Func(struct vcc *tl, const struct vjsn_val *spec,
 
 	vcc_func(tl, &e, spec, extra, sym);
 	if (tl->err)
-		VSB_printf(tl->sb, "While compiling function call:\n");
+		VSB_cat(tl->sb, "While compiling function call:\n");
 	ERRCHK(tl);
 	vcc_expr_fmt(tl->fb, tl->indent, e);
 	VSB_cat(tl->fb, ";\n");
@@ -693,7 +693,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 		ERRCHK(tl);
 		AN(sym);
 		if (sym->kind == SYM_FUNC && sym->type == VOID) {
-			VSB_printf(tl->sb, "Function returns VOID:\n");
+			VSB_cat(tl->sb, "Function returns VOID:\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
 		}
@@ -702,7 +702,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 			AZ(*e);
 			sym->eval(tl, e, t, sym, fmt);
 			if (tl->err) {
-				VSB_printf(tl->sb,
+				VSB_cat(tl->sb,
 				    "While compiling function call:\n\n");
 				vcc_ErrWhere2(tl, t, tl->t);
 			}
@@ -719,7 +719,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 		    PF(t), sym->kind->name);
 		vcc_ErrWhere(tl, t);
 		if (sym->def_b != NULL) {
-			VSB_printf(tl->sb, "That symbol was defined here:\n");
+			VSB_cat(tl->sb, "That symbol was defined here:\n");
 			vcc_ErrWhere(tl, sym->def_b);
 		}
 		return;
@@ -733,8 +733,8 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 				 * sockaddr_un if it happens to exist and
 				 * is a socket. So don't let that happen.
 				 */
-				VSB_printf(tl->sb,
-					"Cannot convert to an IP address: ");
+				VSB_cat(tl->sb,
+				    "Cannot convert to an IP address: ");
 				vcc_ErrToken(tl, tl->t);
 				vcc_ErrWhere(tl, tl->t);
 				return;
@@ -794,7 +794,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 	default:
 		break;
 	}
-	VSB_printf(tl->sb, "Unknown token ");
+	VSB_cat(tl->sb, "Unknown token ");
 	vcc_ErrToken(tl, tl->t);
 	VSB_printf(tl->sb, " when looking for %s\n\n", vcc_utype(fmt));
 	vcc_ErrWhere(tl, tl->t);
@@ -852,7 +852,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 		}
 
 		if (vm->type_from == NULL) {
-			VSB_printf(tl->sb, "Unknown property ");
+			VSB_cat(tl->sb, "Unknown property ");
 			vcc_ErrToken(tl, tl->t);
 			VSB_printf(tl->sb,
 			 " for type %s\n", (*e)->fmt->name);
@@ -1223,7 +1223,7 @@ vcc_expr_not(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 	vcc_expr_tobool(tl, e);
 	ERRCHK(tl);
 	if ((*e)->fmt != BOOL) {
-		VSB_printf(tl->sb, "'!' must be followed by BOOL, found ");
+		VSB_cat(tl->sb, "'!' must be followed by BOOL, found ");
 		VSB_printf(tl->sb, "%s.\n", vcc_utype((*e)->fmt));
 		vcc_ErrWhere2(tl, tk, tl->t);
 	} else {
@@ -1391,7 +1391,7 @@ vcc_Expr(struct vcc *tl, vcc_type_t fmt)
 	assert(e->fmt == fmt);
 
 	vcc_expr_fmt(tl->fb, tl->indent, e);
-	VSB_printf(tl->fb, "\n");
+	VSB_cat(tl->fb, "\n");
 	vcc_delete_expr(e);
 }
 
diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c
index bb695ba92..d501ba8e0 100644
--- a/lib/libvcc/vcc_parse.c
+++ b/lib/libvcc/vcc_parse.c
@@ -294,7 +294,7 @@ vcc_ParseVcl(struct vcc *tl)
 
 	Expect(tl, FNUM);
 	if (tl->t->e - tl->t->b != 3 || tl->t->b[1] != '.') {
-		VSB_printf(tl->sb,
+		VSB_cat(tl->sb,
 		    "Don't play silly buggers with VCL version numbers\n");
 		vcc_ErrWhere(tl, tl->t);
 		ERRCHK(tl);
@@ -314,8 +314,7 @@ vcc_ParseVcl(struct vcc *tl)
 		 * in the built-in VCL, and that would give a very
 		 * confusing error message
 		 */
-		VSB_printf(tl->sb,
-		    "Expected 'vcl N.N;' found no semi-colon\n");
+		VSB_cat(tl->sb, "Expected 'vcl N.N;' found no semi-colon\n");
 		vcc_ErrWhere2(tl, tok0, tl->t);
 		ERRCHK(tl);
 	}
@@ -367,7 +366,7 @@ vcc_Parse(struct vcc *tl)
 
 	AZ(tl->indent);
 	if (tl->t->tok != ID || !vcc_IdIs(tl->t, "vcl")) {
-		VSB_printf(tl->sb,
+		VSB_cat(tl->sb,
 		    "VCL version declaration missing\n"
 		    "Update your VCL to Version 4 syntax, and add\n"
 		    "\tvcl 4.1;\n"
@@ -389,8 +388,7 @@ vcc_Parse(struct vcc *tl)
 				    tl->t->b + 2);
 				vcc_NextToken(tl);
 			} else {
-				VSB_printf(tl->sb,
-				    "Inline-C not allowed\n");
+				VSB_cat(tl->sb, "Inline-C not allowed\n");
 				vcc_ErrWhere(tl, tl->t);
 			}
 			break;
@@ -410,17 +408,17 @@ vcc_Parse(struct vcc *tl)
 			/* FALLTHROUGH */
 		default:
 			/* We deliberately do not mention inline-C */
-			VSB_printf(tl->sb, "Expected one of\n\t");
+			VSB_cat(tl->sb, "Expected one of\n\t");
 			for (tp = toplev; tp->name != NULL; tp++) {
 				if (tp[1].name == NULL)
-					VSB_printf(tl->sb, " or ");
+					VSB_cat(tl->sb, " or ");
 				VSB_printf(tl->sb, "'%s'", tp->name);
 				if (tp[1].name != NULL)
-					VSB_printf(tl->sb, ", ");
+					VSB_cat(tl->sb, ", ");
 			}
-			VSB_printf(tl->sb, "\nFound: ");
+			VSB_cat(tl->sb, "\nFound: ");
 			vcc_ErrToken(tl, tl->t);
-			VSB_printf(tl->sb, " at\n");
+			VSB_cat(tl->sb, " at\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
 		}
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 6da0505e8..4d1a4ee72 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -251,8 +251,7 @@ VCC_SymbolGet(struct vcc *tl, vcc_kind_t kind,
 	    (tl->t->b[1] == 'c'|| tl->t->b[1] == 'C') &&
 	    (tl->t->b[2] == 'l'|| tl->t->b[2] == 'L') &&
 	    (tl->t->b[3] == '_')) {
-		VSB_printf(tl->sb,
-		    "Symbols named 'vcl_*' are reserved.\nAt:");
+		VSB_cat(tl->sb, "Symbols named 'vcl_*' are reserved.\nAt:");
 		vcc_ErrWhere(tl, tl->t);
 		return (NULL);
 	}
@@ -293,36 +292,36 @@ VCC_SymbolGet(struct vcc *tl, vcc_kind_t kind,
 		VSB_printf(tl->sb, "%s: '", e->name);
 		for (tn1 = t0; tn1 != tl->t; tn1 = VTAILQ_NEXT(tn1, list))
 			VSB_printf(tl->sb, "%.*s", PF(tn1));
-		VSB_printf(tl->sb, "'");
+		VSB_cat(tl->sb, "'");
 		sym = vcc_sym_in_tab(tl, st, kind, VCL_LOW, VCL_HIGH);
 		if (sym != NULL) {
-			VSB_printf(tl->sb, " (Only available when");
+			VSB_cat(tl->sb, " (Only available when");
 			if (sym->lorev >= VCL_LOW)
 				VSB_printf(tl->sb, " %.1f <=", .1 * sym->lorev);
-			VSB_printf(tl->sb, " VCL syntax");
+			VSB_cat(tl->sb, " VCL syntax");
 			if (sym->hirev <= VCL_HIGH)
 				VSB_printf(tl->sb, " <= %.1f", .1 * sym->hirev);
-			VSB_printf(tl->sb, ")");
+			VSB_cat(tl->sb, ")");
 		}
 		VSB_cat(tl->sb, "\nAt: ");
 		vcc_ErrWhere2(tl, t0, tl->t);
 		return (NULL);
 	}
 	if (kind != SYM_NONE && kind != sym->kind) {
-		VSB_printf(tl->sb, "Symbol '");
+		VSB_cat(tl->sb, "Symbol '");
 		for (tn1 = t0; tn1 != tl->t; tn1 = VTAILQ_NEXT(tn1, list))
 			VSB_printf(tl->sb, "%.*s", PF(tn1));
 		VSB_printf(tl->sb, "' has wrong type (%s): ", sym->kind->name);
 		VSB_cat(tl->sb, "\nAt: ");
 		vcc_ErrWhere2(tl, t0, tl->t);
 		if (sym->def_b != NULL) {
-			VSB_printf(tl->sb, "Symbol was defined here: ");
+			VSB_cat(tl->sb, "Symbol was defined here: ");
 			vcc_ErrWhere(tl, sym->def_b);
 		} else if (sym->ref_b != NULL) {
-			VSB_printf(tl->sb, "Symbol was declared here: ");
+			VSB_cat(tl->sb, "Symbol was declared here: ");
 			vcc_ErrWhere(tl, sym->ref_b);
 		} else {
-			VSB_printf(tl->sb, "Symbol was builtin\n");
+			VSB_cat(tl->sb, "Symbol was builtin\n");
 		}
 		return (NULL);
 	}
@@ -437,14 +436,14 @@ VCC_HandleSymbol(struct vcc *tl, vcc_type_t fmt, const char *pfx)
 		VSB_printf(tl->sb, "%c%s '%.*s' redefined.\n",
 		    toupper(*p), p + 1, PF(t));
 		vcc_ErrWhere(tl, t);
-		VSB_printf(tl->sb, "First definition:\n");
+		VSB_cat(tl->sb, "First definition:\n");
 		AN(sym->def_b);
 		vcc_ErrWhere(tl, sym->def_b);
 		return (sym);
 	} else if (sym != NULL && sym->def_b != NULL) {
 		VSB_printf(tl->sb, "Name '%.*s' already defined.\n", PF(t));
 		vcc_ErrWhere(tl, t);
-		VSB_printf(tl->sb, "First definition:\n");
+		VSB_cat(tl->sb, "First definition:\n");
 		AN(sym->def_b);
 		vcc_ErrWhere(tl, sym->def_b);
 		return (sym);
diff --git a/lib/libvcc/vcc_token.c b/lib/libvcc/vcc_token.c
index 090c84439..04e10f96b 100644
--- a/lib/libvcc/vcc_token.c
+++ b/lib/libvcc/vcc_token.c
@@ -43,9 +43,9 @@ vcc_ErrToken(const struct vcc *tl, const struct token *t)
 {
 
 	if (t->tok == EOI)
-		VSB_printf(tl->sb, "end of input");
+		VSB_cat(tl->sb, "end of input");
 	else if (t->tok == CSRC)
-		VSB_printf(tl->sb, "C{ ... }C");
+		VSB_cat(tl->sb, "C{ ... }C");
 	else
 		VSB_printf(tl->sb, "'%.*s'", PF(t));
 }
@@ -104,7 +104,7 @@ vcc_icoord(struct vsb *vsb, const struct token *t, int tail)
 		} else
 			pos++;
 	}
-	VSB_printf(vsb, "(");
+	VSB_cat(vsb, "(");
 	if (tail < 2)
 		VSB_printf(vsb, "'%s' Line %u ", t->src->name, lin);
 	VSB_printf(vsb, "Pos %u)", pos + 1);
@@ -255,7 +255,7 @@ vcc_NextToken(struct vcc *tl)
 
 	tl->t = VTAILQ_NEXT(tl->t, list);
 	if (tl->t == NULL) {
-		VSB_printf(tl->sb,
+		VSB_cat(tl->sb,
 		    "Ran out of input, something is missing or"
 		    " maybe unbalanced (...) or {...}\n");
 		tl->err = 1;
@@ -398,7 +398,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
 		if (*p == '/' && p[1] == '*') {
 			for (q = p + 2; q < sp->e; q++) {
 				if (*q == '/' && q[1] == '*') {
-					VSB_printf(tl->sb,
+					VSB_cat(tl->sb,
 					    "/* ... */ comment contains /*\n");
 					vcc_AddToken(tl, EOI, p, p + 2);
 					vcc_ErrWhere(tl, tl->t);
@@ -414,7 +414,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
 			if (q < sp->e)
 				continue;
 			vcc_AddToken(tl, EOI, p, p + 2);
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "Unterminated /* ... */ comment, starting at\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
@@ -440,7 +440,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
 				continue;
 			}
 			vcc_AddToken(tl, EOI, p, p + 2);
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "Unterminated inline C source, starting at\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
@@ -465,7 +465,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
 				continue;
 			}
 			vcc_AddToken(tl, EOI, p, p + 2);
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "Unterminated long-string, starting at\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
@@ -488,7 +488,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
 				}
 				if (*q == '\r' || *q == '\n') {
 					vcc_AddToken(tl, EOI, p, q);
-					VSB_printf(tl->sb,
+					VSB_cat(tl->sb,
 					    "Unterminated string at\n");
 					vcc_ErrWhere(tl, tl->t);
 					return;
@@ -529,7 +529,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
 			continue;
 		}
 		vcc_AddToken(tl, EOI, p, p + 1);
-		VSB_printf(tl->sb, "Syntax error at\n");
+		VSB_cat(tl->sb, "Syntax error at\n");
 		vcc_ErrWhere(tl, tl->t);
 		return;
 	}
diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c
index 8a08e9af9..c0e598532 100644
--- a/lib/libvcc/vcc_utils.c
+++ b/lib/libvcc/vcc_utils.c
@@ -75,7 +75,7 @@ vcc_regexp(struct vcc *tl, struct vsb *vgc_name)
 	ifp = New_IniFin(tl);
 	VSB_printf(ifp->ini, "\tVRT_re_init(&%s, ",buf);
 	EncToken(ifp->ini, tl->t);
-	VSB_printf(ifp->ini, ");");
+	VSB_cat(ifp->ini, ");");
 	VSB_printf(ifp->fin, "\t\tVRT_re_fini(%s);", buf);
 	vcc_NextToken(tl);
 }
@@ -282,7 +282,7 @@ Emit_UDS_Path(struct vcc *tl, const struct token *t_path, const char *errid)
 			   strerror(errno));
 		vcc_ErrWhere(tl, t_path);
 		if (err == ENOENT || err == EACCES) {
-			VSB_printf(tl->sb, "(That was just a warning)\n");
+			VSB_cat(tl->sb, "(That was just a warning)\n");
 			tl->err = 0;
 		} else
 			return;
@@ -311,7 +311,7 @@ vcc_DurationUnit(struct vcc *tl)
 		vcc_NextToken(tl);
 		return (sc);
 	}
-	VSB_printf(tl->sb, "Unknown duration unit ");
+	VSB_cat(tl->sb, "Unknown duration unit ");
 	vcc_ErrToken(tl, tl->t);
 	VSB_printf(tl->sb, "\n%s\n", VNUM_LEGAL_DURATION);
 	vcc_ErrWhere(tl, tl->t);
@@ -382,15 +382,15 @@ vcc_ByteVal(struct vcc *tl, double *d)
 	v = vcc_DoubleVal(tl);
 	ERRCHK(tl);
 	if (tl->t->tok != ID) {
-		VSB_printf(tl->sb, "Expected BYTES unit (B, KB, MB...) got ");
+		VSB_cat(tl->sb, "Expected BYTES unit (B, KB, MB...) got ");
 		vcc_ErrToken(tl, tl->t);
-		VSB_printf(tl->sb, "\n");
+		VSB_cat(tl->sb, "\n");
 		vcc_ErrWhere(tl, tl->t);
 		return;
 	}
 	sc = VNUM_bytes_unit(1.0, tl->t->b, tl->t->e, 0);
 	if (isnan(sc)) {
-		VSB_printf(tl->sb, "Unknown BYTES unit ");
+		VSB_cat(tl->sb, "Unknown BYTES unit ");
 		vcc_ErrToken(tl, tl->t);
 		VSB_printf(tl->sb, "\n%s\n", VNUM_LEGAL_BYTES);
 		vcc_ErrWhere(tl, tl->t);
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index 1a5c13453..846f6d502 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -169,7 +169,7 @@ vcc_VmodSanity(struct vcc *tl, void *hdl, struct token *mod, char *fnp)
 	if (vmd == NULL) {
 		VSB_printf(tl->sb, "Malformed VMOD %.*s\n", PF(mod));
 		VSB_printf(tl->sb, "\tFile name: %s\n", fnp);
-		VSB_printf(tl->sb, "\t(no Vmod_Data symbol)\n");
+		VSB_cat(tl->sb, "\t(no Vmod_Data symbol)\n");
 		vcc_ErrWhere(tl, mod);
 		return (NULL);
 	}
@@ -200,7 +200,7 @@ vcc_VmodSanity(struct vcc *tl, void *hdl, struct token *mod, char *fnp)
 	    vmd->abi == NULL) {
 		VSB_printf(tl->sb, "Mangled VMOD %.*s\n", PF(mod));
 		VSB_printf(tl->sb, "\tFile name: %s\n", fnp);
-		VSB_printf(tl->sb, "\tInconsistent metadata\n");
+		VSB_cat(tl->sb, "\tInconsistent metadata\n");
 		vcc_ErrWhere(tl, mod);
 		return (NULL);
 	}
@@ -246,13 +246,13 @@ vcc_ParseImport(struct vcc *tl)
 
 	if (tl->t->tok == ID) {
 		if (!vcc_IdIs(tl->t, "from")) {
-			VSB_printf(tl->sb, "Expected 'from path ...'\n");
+			VSB_cat(tl->sb, "Expected 'from path ...'\n");
 			vcc_ErrWhere(tl, tl->t);
 			return;
 		}
 		vcc_NextToken(tl);
 		if (!tl->unsafe_path && strchr(tl->t->dec, '/')) {
-			VSB_printf(tl->sb,
+			VSB_cat(tl->sb,
 			    "'import ... from path ...' is unsafe.\nAt:");
 			vcc_ErrToken(tl, tl->t);
 			vcc_ErrWhere(tl, tl->t);
@@ -328,32 +328,32 @@ vcc_ParseImport(struct vcc *tl)
 
 	ifp = New_IniFin(tl);
 
-	VSB_printf(ifp->ini, "\tif (VPI_Vmod_Init(ctx,\n");
+	VSB_cat(ifp->ini, "\tif (VPI_Vmod_Init(ctx,\n");
 	VSB_printf(ifp->ini, "\t    &VGC_vmod_%.*s,\n", PF(mod));
 	VSB_printf(ifp->ini, "\t    %u,\n", tl->vmod_count++);
 	VSB_printf(ifp->ini, "\t    &%s,\n", vmd->func_name);
 	VSB_printf(ifp->ini, "\t    sizeof(%s),\n", vmd->func_name);
 	VSB_printf(ifp->ini, "\t    \"%.*s\",\n", PF(mod));
-	VSB_printf(ifp->ini, "\t    ");
+	VSB_cat(ifp->ini, "\t    ");
 	VSB_quote(ifp->ini, fnpx, -1, VSB_QUOTE_CSTR);
-	VSB_printf(ifp->ini, ",\n");
+	VSB_cat(ifp->ini, ",\n");
 	AN(vmd);
 	AN(vmd->file_id);
 	VSB_printf(ifp->ini, "\t    \"%s\",\n", vmd->file_id);
 	VSB_printf(ifp->ini, "\t    \"./vmod_cache/_vmod_%.*s.%s\"\n",
 	    PF(mod), vmd->file_id);
-	VSB_printf(ifp->ini, "\t    ))\n");
-	VSB_printf(ifp->ini, "\t\treturn(1);");
+	VSB_cat(ifp->ini, "\t    ))\n");
+	VSB_cat(ifp->ini, "\t\treturn(1);");
 
-	VSB_printf(tl->symtab, ",\n    {\n");
-	VSB_printf(tl->symtab, "\t\"dir\": \"import\",\n");
-	VSB_printf(tl->symtab, "\t\"type\": \"$VMOD\",\n");
+	VSB_cat(tl->symtab, ",\n    {\n");
+	VSB_cat(tl->symtab, "\t\"dir\": \"import\",\n");
+	VSB_cat(tl->symtab, "\t\"type\": \"$VMOD\",\n");
 	VSB_printf(tl->symtab, "\t\"name\": \"%.*s\",\n", PF(mod));
 	VSB_printf(tl->symtab, "\t\"file\": \"%s\",\n", fnpx);
 	VSB_printf(tl->symtab,
 	    "\t\"dst\": \"./vmod_cache/_vmod_%.*s.%s\"\n",
 	    PF(mod), vmd->file_id);
-	VSB_printf(tl->symtab, "    }");
+	VSB_cat(tl->symtab, "    }");
 
 	/* XXX: zero the function pointer structure ?*/
 	VSB_printf(ifp->fin, "\t\tVRT_priv_fini(&vmod_priv_%.*s);", PF(mod));
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index dd0893c23..e5f5f2858 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -84,7 +84,7 @@ vcc_checkref(struct vcc *tl, const struct symbol *sym)
 		    sym->kind->name, PF(sym->def_b));
 		vcc_ErrWhere(tl, sym->def_b);
 		if (!tl->err_unref) {
-			VSB_printf(tl->sb, "(That was just a warning)\n");
+			VSB_cat(tl->sb, "(That was just a warning)\n");
 			tl->err = 0;
 		}
 	}
@@ -155,7 +155,7 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
 
 	AN(p);
 	if (p->active) {
-		VSB_printf(tl->sb, "Function recurses on\n");
+		VSB_cat(tl->sb, "Function recurses on\n");
 		vcc_ErrWhere(tl, p->name);
 		return (1);
 	}
@@ -209,13 +209,13 @@ vcc_checkaction1(struct vcc *tl, const struct symbol *sym)
 	if (vcc_CheckActionRecurse(tl, p, p->method->ret_bitmap)) {
 		VSB_printf(tl->sb,
 		    "\n...which is the \"%s\" method\n", p->method->name);
-		VSB_printf(tl->sb, "Legal returns are:");
+		VSB_cat(tl->sb, "Legal returns are:");
 #define VCL_RET_MAC(l, U, B)						\
 		if (p->method->ret_bitmap & ((1 << VCL_RET_##U)))	\
 			VSB_printf(tl->sb, " \"%s\"", #l);
 
 #include "tbl/vcl_returns.h"
-		VSB_printf(tl->sb, "\n");
+		VSB_cat(tl->sb, "\n");
 		tl->err = 1;
 	}
 
@@ -231,10 +231,10 @@ vcc_checkaction2(struct vcc *tl, const struct symbol *sym)
 
 	if (p->called)
 		return;
-	VSB_printf(tl->sb, "Function unused\n");
+	VSB_cat(tl->sb, "Function unused\n");
 	vcc_ErrWhere(tl, p->name);
 	if (!tl->err_unref) {
-		VSB_printf(tl->sb, "(That was just a warning)\n");
+		VSB_cat(tl->sb, "(That was just a warning)\n");
 		tl->err = 0;
 	}
 }
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index d6171d677..fd408f767 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -357,7 +357,7 @@ event_load(VRT_CTX, struct vmod_priv *priv)
 	loads++;
 
 	if (cache_param->nuke_limit == 42) {
-		VSB_printf(ctx->msg, "nuke_limit is not the answer.");
+		VSB_cat(ctx->msg, "nuke_limit is not the answer.");
 		return (-1);
 	}
 
@@ -414,7 +414,7 @@ event_warm(VRT_CTX, const struct vmod_priv *priv)
 
 	AN(ctx->msg);
 	if (cache_param->max_esi_depth == 42) {
-		VSB_printf(ctx->msg, "max_esi_depth is not the answer.");
+		VSB_cat(ctx->msg, "max_esi_depth is not the answer.");
 		return (-1);
 	}
 
diff --git a/tools/coccinelle/printf_nofmt.cocci b/tools/coccinelle/printf_nofmt.cocci
new file mode 100644
index 000000000..a4c6d559b
--- /dev/null
+++ b/tools/coccinelle/printf_nofmt.cocci
@@ -0,0 +1,10 @@
+/*
+ * This patch removes useless calls to printf-type functions.
+ */
+
+@@
+expression vsb, fmt;
+@@
+
+- VSB_printf(vsb, fmt);
++ VSB_cat(vsb, fmt);


More information about the varnish-commit mailing list