[master] 178542568 Teach vcc_strands_edit the empty strands

Nils Goroll nils.goroll at uplex.de
Fri Aug 16 10:42:05 UTC 2024


commit 1785425680282dab3395d5f52eb28b8d45f948a7
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Aug 1 11:53:13 2024 +0200

    Teach vcc_strands_edit the empty strands

diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index e95a4de3e..afff5ce9d 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -152,13 +152,18 @@ static void
 vcc_strands_edit(const struct expr *e1, const struct expr *e2)
 {
 
-	if (e2->nstr == 1) {
+	assert(e2->fmt == STRANDS || e2->fmt == STRINGS);
+
+	if (e2->fmt == STRANDS)
+		VSB_cat(e1->vsb, VSB_data(e2->vsb));
+	else if (e2->nstr == 0)
+		VSB_printf(e1->vsb, "vrt_null_strands");
+	else if (e2->nstr == 1)
 		VSB_printf(e1->vsb, "TOSTRAND(%s)", VSB_data(e2->vsb));
-		return;
+	else {
+		VSB_printf(e1->vsb, "TOSTRANDS(%d,\v+\n%s\v-)",
+		   e2->nstr, VSB_data(e2->vsb));
 	}
-
-	VSB_printf(e1->vsb, "TOSTRANDS(%d,\v+\n%s\v-)",
-	    e2->nstr, VSB_data(e2->vsb));
 }
 
 static struct expr *


More information about the varnish-commit mailing list