[master] 7427860 Avoid unneeded conversions

Federico G. Schwindt fgsch at lodoss.net
Mon Sep 12 00:06:09 CEST 2016


commit 7427860ff11cd789b40ff39c0671ca4fbb28d19b
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sun Sep 11 18:14:32 2016 +0100

    Avoid unneeded conversions

diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 9624af2..573d497 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -377,6 +377,7 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 
 	CHECK_OBJ_NOTNULL(*e, EXPR_MAGIC);
 	AN(fmt == STRING || fmt == STRING_LIST);
+	AZ(fmt == (*e)->fmt);
 
 	p = (*e)->fmt->tostring;
 	if (p == NULL && (*e)->fmt == BLOB) {
@@ -1300,7 +1301,7 @@ vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 		}
 		*e = vcc_expr_edit(BOOL, "\v1\v-\n)", *e, NULL);
 	}
-	if (fmt == STRING || fmt == STRING_LIST) {
+	if (fmt != (*e)->fmt && (fmt == STRING || fmt == STRING_LIST)) {
 		vcc_expr_tostring(tl, e, fmt);
 		ERRCHK(tl);
 	}



More information about the varnish-commit mailing list