r2881 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Mon Jul 7 19:19:32 CEST 2008


Author: phk
Date: 2008-07-07 19:19:32 +0200 (Mon, 07 Jul 2008)
New Revision: 2881

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_backend.c
Log:
Improve error messages related to syntax check of backend decls.



Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_backend.c	2008-07-07 17:19:10 UTC (rev 2880)
+++ trunk/varnish-cache/lib/libvcl/vcc_backend.c	2008-07-07 17:19:32 UTC (rev 2881)
@@ -172,7 +172,7 @@
 	return;
 }
 
-static void
+static int
 vcc_FieldsOk(struct tokenlist *tl, const struct fld_spec *fs)
 {
 	int ok = 1;
@@ -180,14 +180,11 @@
 	for (; fs->name != NULL; fs++) {
 		if (*fs->name == '!' && fs->found == NULL) {
 			vsb_printf(tl->sb,
-			    "Mandatory field .'%s' missing.\n", fs->name + 1);
+			    "Mandatory field '%s' missing.\n", fs->name + 1);
 			ok = 0;
 		}
 	}
-	if (!ok) {
-		vcc_ErrWhere(tl, tl->t);
-	}
-	return;
+	return (ok);
 }
 
 
@@ -291,9 +288,7 @@
 		ExpectErr(tl, ';');
 		vcc_NextToken(tl);
 	}
-	if (!tl->err)
-		vcc_FieldsOk(tl, fs);
-	if (tl->err) {
+	if (tl->err || !vcc_FieldsOk(tl, fs)) {
 		vsb_printf(tl->sb,
 		    "\nIn backend host specfication starting at:\n");
 		vcc_ErrWhere(tl, t_first);




More information about the varnish-commit mailing list