if (mg->mg_type == PERL_MAGIC_qr) {
const regexp * const re = (regexp *)mg->mg_obj;
SV * const dsv = sv_newmortal();
- const char * const s = pv_pretty(dsv, re->wrapped, re->wraplen,
+ const char * const s
+ = pv_pretty(dsv, RX_WRAPPED(re), RX_WRAPLEN(re),
60, NULL, NULL,
( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_PRETTY_ELLIPSES |
((re->extflags & RXf_UTF8) ? PERL_PV_ESCAPE_UNI : 0))
} else {
/* Scalar, so use the string that Perl would return */
/* return the pattern in (?msix:..) format */
- pattern = sv_2mortal(newSVpvn(re->wrapped,re->wraplen));
+ pattern = sv_2mortal(newSVpvn(RX_WRAPPED(re),RX_WRAPLEN(re)));
if (re->extflags & RXf_UTF8)
SvUTF8_on(pattern);
XPUSHs(pattern);
U16 reganch = (U16)((r->extflags & RXf_PMf_STD_PMMOD) >> 12);
const char *fptr = STD_PAT_MODS; /*"msix"*/
char *p;
- r->wraplen = plen + has_minus + has_p + has_runon
+ RX_WRAPLEN(r) = plen + has_minus + has_p + has_runon
+ (sizeof(STD_PAT_MODS) - 1)
+ (sizeof("(?:)") - 1);
- Newx(r->wrapped, r->wraplen + 1, char );
- p = r->wrapped;
+ Newx(RX_WRAPPED(r), RX_WRAPLEN(r) + 1, char );
+ p = RX_WRAPPED(r);
*p++='('; *p++='?';
if (has_p)
*p++ = KEEPCOPY_PAT_MOD; /*'p'*/
*p++ = ':';
Copy(RExC_precomp, p, plen, char);
- assert ((r->wrapped - p) < 16);
- r->pre_prefix = p - r->wrapped;
+ assert ((RX_WRAPPED(r) - p) < 16);
+ r->pre_prefix = p - RX_WRAPPED(r);
p += plen;
if (has_runon)
*p++ = '\n';
CALLREGFREE_PVT(r); /* free the private data */
if (r->paren_names)
SvREFCNT_dec(r->paren_names);
- Safefree(r->wrapped);
+ Safefree(RX_WRAPPED(r));
}
if (r->substrs) {
if (r->anchored_substr)
}
}
- ret->wrapped = SAVEPVN(ret->wrapped, ret->wraplen+1);
+ RX_WRAPPED(ret) = SAVEPVN(RX_WRAPPED(ret), RX_WRAPLEN(ret)+1);
ret->paren_names = hv_dup_inc(ret->paren_names, param);
if (ret->pprivate)
if (flags)
*flags = ((re->extflags & RXf_UTF8) ? 1 : 0);
if (lp)
- *lp = re->wraplen;
- return re->wrapped;
+ *lp = RX_WRAPLEN(re);
+ return RX_WRAPPED(re);
}
/*
writers? Specifically, the value 1 assumes that the wrapped version always
has exactly one character at the end, a ')'. Will that always be true? */
#define RX_PRELEN(prog) ((prog)->wraplen - (prog)->pre_prefix - 1)
+#define RX_WRAPPED(prog) ((prog)->wrapped)
+#define RX_WRAPLEN(prog) ((prog)->wraplen)
+
#endif /* PLUGGABLE_RE_EXTENSION */