[master] 05f5cd8 Create query and then set the cursor

Martin Blix Grydeland martin at varnish-software.com
Thu Apr 9 15:16:28 CEST 2015


commit 05f5cd86f9bd7b3fc0d4154a01e4af51f873dcba
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Mar 31 17:36:59 2015 +0200

    Create query and then set the cursor
    
    This makes query expression errors be reported before any VSM
    connection related errors.

diff --git a/lib/libvarnishtools/vut.c b/lib/libvarnishtools/vut.c
index 6c4a683..39829e1 100644
--- a/lib/libvarnishtools/vut.c
+++ b/lib/libvarnishtools/vut.c
@@ -213,10 +213,15 @@ VUT_Setup(void)
 	struct VSL_cursor *c;
 
 	AN(VUT.vsl);
-
-	/* Input */
 	if (VUT.r_arg && VUT.vsm)
 		VUT_Error(1, "Can't have both -n and -r options");
+
+	/* Create query */
+	VUT.vslq = VSLQ_New(VUT.vsl, NULL, VUT.g_arg, VUT.q_arg);
+	if (VUT.vslq == NULL)
+		VUT_Error(1, "Query expression error:\n%s", VSL_Error(VUT.vsl));
+
+	/* Input cursor */
 	if (VUT.r_arg) {
 		REPLACE(VUT.name, VUT.r_arg);
 		c = VSL_CursorFile(VUT.vsl, VUT.r_arg, 0);
@@ -235,11 +240,7 @@ VUT_Setup(void)
 	}
 	if (c == NULL)
 		VUT_Error(1, "Can't open log (%s)", VSL_Error(VUT.vsl));
-
-	/* Create query */
-	VUT.vslq = VSLQ_New(VUT.vsl, &c, VUT.g_arg, VUT.q_arg);
-	if (VUT.vslq == NULL)
-		VUT_Error(1, "Query expression error:\n%s", VSL_Error(VUT.vsl));
+	VSLQ_SetCursor(VUT.vslq, &c);
 	AZ(c);
 
 	/* Signal handlers */



More information about the varnish-commit mailing list