From c69809b122983844f8bd8b4aee05f30c16da5239 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 7 Jul 2008 17:19:32 +0000 Subject: [PATCH] Improve error messages related to syntax check of backend decls. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2881 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/lib/libvcl/vcc_backend.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/varnish-cache/lib/libvcl/vcc_backend.c b/varnish-cache/lib/libvcl/vcc_backend.c index f54d988b..3dc32e81 100644 --- a/varnish-cache/lib/libvcl/vcc_backend.c +++ b/varnish-cache/lib/libvcl/vcc_backend.c @@ -172,7 +172,7 @@ vcc_IsField(struct tokenlist *tl, struct token **t, struct fld_spec *fs) return; } -static void +static int vcc_FieldsOk(struct tokenlist *tl, const struct fld_spec *fs) { int ok = 1; @@ -180,14 +180,11 @@ vcc_FieldsOk(struct tokenlist *tl, const struct fld_spec *fs) 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 @@ vcc_ParseBackendHost(struct tokenlist *tl, int *nbh, const struct token *name, c 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); -- 2.39.5