From b6559c952c47491594a63305721a5c3b874e9be4 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 14 Nov 2008 09:48:57 +0000 Subject: [PATCH] Inline VRT_re_test() git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3392 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/lib/libvcl/vcc_string.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/varnish-cache/lib/libvcl/vcc_string.c b/varnish-cache/lib/libvcl/vcc_string.c index 39b4b224..cb87a03f 100644 --- a/varnish-cache/lib/libvcl/vcc_string.c +++ b/varnish-cache/lib/libvcl/vcc_string.c @@ -33,6 +33,7 @@ #include #include +#include #include "vsb.h" @@ -47,13 +48,22 @@ char * vcc_regexp(struct tokenlist *tl, int sub) { - char buf[32], *p; + char buf[BUFSIZ], *p; + regex_t t; + int i; Expect(tl, CSTR); - if (VRT_re_test(tl->sb, tl->t->dec, sub)) { + memset(&t, 0, sizeof t); + i = regcomp(&t, tl->t->dec, REG_EXTENDED | (sub ? 0 : REG_NOSUB)); + if (i != 0) { + (void)regerror(i, &t, buf, sizeof buf); + vsb_printf(tl->sb, + "Regexp compilation error:\n\n%s\n\n", buf); vcc_ErrWhere(tl, tl->t); + regfree(&t); return (NULL); } + regfree(&t); sprintf(buf, "VGC_re_%u", tl->recnt++); p = TlAlloc(tl, strlen(buf) + 1); strcpy(p, buf); -- 2.39.5