]> err.no Git - varnish/commitdiff
Inline VRT_re_test()
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 14 Nov 2008 09:48:57 +0000 (09:48 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 14 Nov 2008 09:48:57 +0000 (09:48 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3392 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvcl/vcc_string.c

index 39b4b22429b201c247de2cf4896178c14a7dcdd2..cb87a03f2633daf882f0be8960ce8207cc3bbfc6 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <regex.h>
 
 #include "vsb.h"
 
 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);