[4.1] d25080d Use VSB_putc for single char ops

Lasse Karstensen lkarsten at varnish-software.com
Thu Jan 14 15:15:09 CET 2016


commit d25080d165bee2ead747019e68d1c2a63b8ca872
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Mon Dec 14 11:06:39 2015 +0000

    Use VSB_putc for single char ops

diff --git a/bin/varnishd/cache/cache_ban_build.c b/bin/varnishd/cache/cache_ban_build.c
index 801774f..b3bda03 100644
--- a/bin/varnishd/cache/cache_ban_build.c
+++ b/bin/varnishd/cache/cache_ban_build.c
@@ -105,7 +105,7 @@ ban_add_lump(const struct ban_proto *bp, const void *p, uint32_t len)
 
 	buf[0] = 0xff;
 	while (VSB_len(bp->vsb) & PALGN)
-		VSB_bcat(bp->vsb, buf, 1);
+		VSB_putc(bp->vsb, buf[0]);
 	vbe32enc(buf, len);
 	VSB_bcat(bp->vsb, buf, sizeof buf);
 	VSB_bcat(bp->vsb, p, len);
diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index 76591d0..383731f 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -906,7 +906,7 @@ VEP_Parse(struct vep_state *vep, const char *p, size_t l)
 			while (p < e && *p != '>' && *p != vep->attr_delim &&
 			   (vep->attr_delim != ' ' || !vct_issp(*p))) {
 				if (vep->attr_vsb != NULL)
-					VSB_bcat(vep->attr_vsb, p, 1);
+					VSB_putc(vep->attr_vsb, *p);
 				p++;
 			}
 			if (p < e && *p == '>') {
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 614317a..b60ddbd 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -526,7 +526,7 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
 		}
 	}
 	VSB_printf(pan_vsb, "\n");
-	VSB_bcat(pan_vsb, "", 1);	/* NUL termination */
+	VSB_putc(pan_vsb, '\0');	/* NUL termination */
 
 	if (FEATURE(FEATURE_NO_COREDUMP))
 		exit(4);
diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c
index 5dad106..db91b30 100644
--- a/lib/libvarnishapi/vxp.c
+++ b/lib/libvarnishapi/vxp.c
@@ -82,9 +82,9 @@ vxp_quote(const struct vxp *vxp, const char *b, const char *e, int tokoff)
 	assert(e <= vxp->e);
 	for (p = vxp->b; p < vxp->e; p++) {
 		if (isspace(*p))
-			VSB_bcat(vxp->sb, " ", 1);
+			VSB_putc(vxp->sb, ' ');
 		else
-			VSB_bcat(vxp->sb, p, 1);
+			VSB_putc(vxp->sb, *p);
 	}
 	VSB_putc(vxp->sb, '\n');
 	for (p = vxp->b; p < vxp->e; p++) {
diff --git a/lib/libvcc/vcc_token.c b/lib/libvcc/vcc_token.c
index 6201fea..a8513f8 100644
--- a/lib/libvcc/vcc_token.c
+++ b/lib/libvcc/vcc_token.c
@@ -135,13 +135,13 @@ vcc_quoteline(const struct vcc *tl, const char *l, const char *le)
 			y &= ~7;
 			y += 8;
 			while (x < y) {
-				VSB_bcat(tl->sb, " ", 1);
+				VSB_putc(tl->sb, ' ');
 				x++;
 			}
 		} else {
 			x++;
 			y++;
-			VSB_bcat(tl->sb, p, 1);
+			VSB_putc(tl->sb, *p);
 		}
 	}
 	VSB_putc(tl->sb, '\n');



More information about the varnish-commit mailing list