[master] 16977fc Teach vcc_expr_tostring how to handle STRING_LIST

Federico G. Schwindt fgsch at lodoss.net
Mon Sep 12 12:35:14 CEST 2016


commit 16977fcc55298c9559afd478c7ad90a3508dbdff
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Mon Sep 12 09:51:54 2016 +0100

    Teach vcc_expr_tostring how to handle STRING_LIST

diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 573d497..415c584 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -379,6 +379,10 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 	AN(fmt == STRING || fmt == STRING_LIST);
 	AZ(fmt == (*e)->fmt);
 
+	if ((*e)->fmt == STRING || ((*e)->fmt == STRING_LIST && vcc_isconst(*e))) {
+		(*e)->fmt = fmt;
+		return;
+	}
 	p = (*e)->fmt->tostring;
 	if (p == NULL && (*e)->fmt == BLOB) {
 		VSB_printf(tl->sb,
diff --git a/lib/libvcc/vcc_types.c b/lib/libvcc/vcc_types.c
index f6ab02e..b47e7f3 100644
--- a/lib/libvcc/vcc_types.c
+++ b/lib/libvcc/vcc_types.c
@@ -141,7 +141,7 @@ const struct type STRING[1] = {{
 const struct type STRING_LIST[1] = {{
 	.magic =		TYPE_MAGIC,
 	.name =			"STRING_LIST",
-	.tostring =		"",
+	.tostring =		"VRT_CollectString(ctx,\n\v1,\nvrt_magic_string_end)",
 }};
 
 const struct type TIME[1] = {{



More information about the varnish-commit mailing list