r3608 - branches/2.0/varnish-cache/lib/libvcl
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Thu Feb 5 12:10:59 CET 2009
Author: tfheen
Date: 2009-02-05 12:10:59 +0100 (Thu, 05 Feb 2009)
New Revision: 3608
Modified:
branches/2.0/varnish-cache/lib/libvcl/vcc_string.c
Log:
Merge r3392: Inline VRT_re_test()
Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_string.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_string.c 2009-02-05 11:07:27 UTC (rev 3607)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_string.c 2009-02-05 11:10:59 UTC (rev 3608)
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <string.h>
+#include <regex.h>
#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);
More information about the varnish-commit
mailing list