Commit 31567772 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Implement VRE options with hard linkage to PCRE options instead

of maintaining magic hex-bit values that must match.
parent e700b07f
...@@ -48,8 +48,8 @@ typedef struct vre vre_t; ...@@ -48,8 +48,8 @@ typedef struct vre vre_t;
#define VRE_ERROR_NOMATCH (-1) #define VRE_ERROR_NOMATCH (-1)
/* And those to PCRE options */ /* And those to PCRE options */
#define VRE_CASELESS 0x00000001 extern const unsigned VRE_CASELESS;
#define VRE_NOTEMPTY_ATSTART 0x10000000 extern const unsigned VRE_NOTEMPTY_ATSTART;
vre_t *VRE_compile(const char *, int, const char **, int *); vre_t *VRE_compile(const char *, int, const char **, int *);
int VRE_exec(const vre_t *code, const char *subject, int length, int VRE_exec(const vre_t *code, const char *subject, int length,
......
...@@ -39,6 +39,19 @@ struct vre { ...@@ -39,6 +39,19 @@ struct vre {
pcre *re; 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_t *
VRE_compile(const char *pattern, int options, VRE_compile(const char *pattern, int options,
const char **errptr, int *erroffset) const char **errptr, int *erroffset)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment