r4971 - trunk/varnish-cache/lib/libvcl
phk at varnish-cache.org
phk at varnish-cache.org
Fri Jun 18 11:12:52 CEST 2010
Author: phk
Date: 2010-06-18 11:12:52 +0200 (Fri, 18 Jun 2010)
New Revision: 4971
Modified:
trunk/varnish-cache/lib/libvcl/vcc_action.c
trunk/varnish-cache/lib/libvcl/vcc_parse.c
Log:
Use ExpectErr() instead of Expect, so that we get compiler error messages
rather than panics.
Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-06-17 08:47:19 UTC (rev 4970)
+++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-06-18 09:12:52 UTC (rev 4971)
@@ -283,7 +283,7 @@
vcc_NextToken(tl);
- Expect(tl, '(');
+ ExpectErr(tl, '(');
vcc_NextToken(tl);
if (tl->t->tok == VAR) {
@@ -352,7 +352,7 @@
Fb(tl, 0, "vrt_magic_string_end);\n");
}
- Expect(tl, ')');
+ ExpectErr(tl, ')');
vcc_NextToken(tl);
}
@@ -363,7 +363,7 @@
{
vcc_NextToken(tl);
- Expect(tl, '(');
+ ExpectErr(tl, '(');
vcc_NextToken(tl);
Fb(tl, 1, "VRT_ban(sp, \"req.url\", \"~\", ");
@@ -371,7 +371,7 @@
vcc_ExpectedStringval(tl);
return;
}
- Expect(tl, ')');
+ ExpectErr(tl, ')');
vcc_NextToken(tl);
Fb(tl, 0, ", 0);\n");
}
@@ -423,9 +423,9 @@
int retval = 0;
vcc_NextToken(tl);
- Expect(tl, '(');
+ ExpectErr(tl, '(');
vcc_NextToken(tl);
- Expect(tl, ID);
+ ExpectErr(tl, ID);
#define VCL_RET_MAC(l, U) \
do { \
@@ -443,7 +443,7 @@
ERRCHK(tl);
}
vcc_NextToken(tl);
- Expect(tl, ')');
+ ExpectErr(tl, ')');
vcc_NextToken(tl);
}
Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-06-17 08:47:19 UTC (rev 4970)
+++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-06-18 09:12:52 UTC (rev 4971)
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <string.h>
+#include <math.h>
#include "vsb.h"
@@ -153,6 +154,8 @@
const char *p;
Expect(tl, CNUM);
+ if (tl->err)
+ return (NAN);
for (p = tl->t->b; p < tl->t->e; p++) {
d *= 10;
d += *p - '0';
More information about the varnish-commit
mailing list