summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/regcomp.c b/regcomp.c
index ae2b02ee75..14a6e46eb5 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -118,6 +118,8 @@ static void regoptail _((regnode *, regnode *));
static void regset _((char *, I32));
static void regtail _((regnode *, regnode *));
static char* nextchar _((void));
+
+static void re_croak2 _((const char* pat1,const char* pat2,...)) __attribute__((noreturn));
#endif
/* Length of a variant. */
@@ -791,6 +793,11 @@ pregcomp(char *exp, char *xend, PMOP *pm)
r->regstclass = NULL;
r->naughty = regnaughty >= 10; /* Probably an expensive pattern. */
scan = r->program + 1; /* First BRANCH. */
+
+ /* XXXX To minimize changes to RE engine we always allocate
+ 3-units-long substrs field. */
+ Newz(1004, r->substrs, 1, struct reg_substr_data);
+
if (OP(scan) != BRANCH) { /* Only one top-level choice. */
scan_data_t data;
I32 fake;
@@ -885,7 +892,7 @@ pregcomp(char *exp, char *xend, PMOP *pm)
r->float_substr = data.longest_float;
r->float_min_offset = data.offset_float_min;
r->float_max_offset = data.offset_float_max;
- fbm_compile(r->float_substr);
+ fbm_compile(r->float_substr, 0);
BmUSEFUL(r->float_substr) = 100;
if (data.flags & SF_FL_BEFORE_EOL /* Cannot have SEOL and MULTI */
&& (!(data.flags & SF_FL_BEFORE_MEOL)
@@ -905,7 +912,7 @@ pregcomp(char *exp, char *xend, PMOP *pm)
|| (regflags & PMf_MULTILINE)))) {
r->anchored_substr = data.longest_fixed;
r->anchored_offset = data.offset_fixed;
- fbm_compile(r->anchored_substr);
+ fbm_compile(r->anchored_substr, 0);
BmUSEFUL(r->anchored_substr) = 100;
if (data.flags & SF_FIX_BEFORE_EOL /* Cannot have SEOL and MULTI */
&& (!(data.flags & SF_FIX_BEFORE_MEOL)
@@ -2544,6 +2551,8 @@ pregfree(struct regexp *r)
Safefree(r->precomp);
if (r->subbase)
Safefree(r->subbase);
+ if (r->substrs)
+ Safefree(r->substrs);
if (r->anchored_substr)
SvREFCNT_dec(r->anchored_substr);
if (r->float_substr)
@@ -2601,11 +2610,11 @@ regnext(register regnode *p)
}
#ifdef I_STDARG
-void
+static void
re_croak2(const char* pat1,const char* pat2,...)
#else
/*VARARGS0*/
-void
+static void
re_croak2(const char* pat1,const char* pat2, va_alist)
const char* pat1;
const char* pat2;