[experimental-ims] 992ebc9 Implement VRE options with hard linkage to PCRE options instead of maintaining magic hex-bit values that must match.
Geoff Simmons
geoff at varnish-cache.org
Mon Jan 9 21:52:30 CET 2012
commit 992ebc91708a50ebf383f8ec58ac7b402c092617
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Nov 8 15:04:04 2011 +0000
Implement VRE options with hard linkage to PCRE options instead
of maintaining magic hex-bit values that must match.
diff --git a/include/vre.h b/include/vre.h
index a1206e5..59ffeb0 100644
--- a/include/vre.h
+++ b/include/vre.h
@@ -48,8 +48,8 @@ typedef struct vre vre_t;
#define VRE_ERROR_NOMATCH (-1)
/* And those to PCRE options */
-#define VRE_CASELESS 0x00000001
-#define VRE_NOTEMPTY_ATSTART 0x10000000
+extern const unsigned VRE_CASELESS;
+extern const unsigned VRE_NOTEMPTY_ATSTART;
vre_t *VRE_compile(const char *, int, const char **, int *);
int VRE_exec(const vre_t *code, const char *subject, int length,
diff --git a/lib/libvarnish/vre.c b/lib/libvarnish/vre.c
index 9b1d911..cffe396 100644
--- a/lib/libvarnish/vre.c
+++ b/lib/libvarnish/vre.c
@@ -43,6 +43,19 @@ struct vre {
pcre *re;
};
+/*
+ * We don't want to spread or even expose the majority of PCRE options
+ * so we establish our own options and implement hard linkage to PCRE
+ * here.
+ */
+const unsigned VRE_CASELESS = PCRE_CASELESS;
+const unsigned VRE_NOTEMPTY_ATSTART =
+#ifdef PCRE_NOTEMPTY_ATSTART
+ PCRE_NOTEMPTY_ATSTART;
+#else
+ 0;
+#endif
+
vre_t *
VRE_compile(const char *pattern, int options,
const char **errptr, int *erroffset)
More information about the varnish-commit
mailing list