[master] 70631ecbf Put the abbreviation marker outside the (optional) double quotes, and be consistent about the order of the ending.

Poul-Henning Kamp phk at FreeBSD.org
Mon Dec 8 13:19:04 UTC 2025


commit 70631ecbff738f8f0ed2ff0223dfb768b4d825eb
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Dec 8 12:54:07 2025 +0000

    Put the abbreviation marker outside the (optional) double quotes, and be consistent about the order of the ending.

diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index 42ae51c7e..bdf42594e 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -591,13 +591,13 @@ VSB_quote_pfx(struct vsb *s, const char *pfx, const void *v, int len, int how)
 
 	if (!quote) {
 		VSB_bcat(s, p, len);
+		if (how & VSB_QUOTE_CSTR)
+			VSB_putc(s, '"');
 		if (how & VSB_QUOTE_ABBREVIATE)
 			VSB_cat(s, "[...]");
 		if ((how & VSB_QUOTE_NONL) &&
 		    p[len-1] != '\n')
 			(void)VSB_putc(s, '\n');
-		if (how & VSB_QUOTE_CSTR)
-			VSB_putc(s, '"');
 		return;
 	}
 
@@ -651,10 +651,10 @@ VSB_quote_pfx(struct vsb *s, const char *pfx, const void *v, int len, int how)
 			break;
 		}
 	}
-	if (how & VSB_QUOTE_ABBREVIATE)
-		VSB_cat(s, "[...]");
 	if (how & VSB_QUOTE_CSTR)
 		VSB_putc(s, '"');
+	if (how & VSB_QUOTE_ABBREVIATE)
+		VSB_cat(s, "[...]");
 	if ((how & VSB_QUOTE_NONL) && !nl)
 		VSB_putc(s, '\n');
 }
diff --git a/lib/libvarnish/vsb_test.c b/lib/libvarnish/vsb_test.c
index 593c05cd3..7353dc73b 100644
--- a/lib/libvarnish/vsb_test.c
+++ b/lib/libvarnish/vsb_test.c
@@ -129,7 +129,7 @@ static struct tc tcs[] = {
 	{
 		VSB_QUOTE_CSTR | VSB_QUOTE_ABBREVIATE,
 		11, "Hello World\n",
-		"PFX\"Hello [...]\"",
+		"PFX\"Hello \"[...]",
 	},
 	{
 		0, -1, NULL, NULL



More information about the varnish-commit mailing list