myaref => [ $RV_class, '\\\\' ],
myfl => [ 'NV', myfl ],
myint => [ 'IV', myint ],
+ $] >= 5.011 ? (
+ myrex => [ $RV_class, '\\\\"\\(?-xism:Foo\\)"' ],
+ ) : (
myrex => [ $RV_class, '\\\\' ],
+ ),
myundef => [ 'NULL', ],
) : (
myaref => [ 'PVIV', '' ],
+ (sizeof(STD_PAT_MODS) - 1)
+ (sizeof("(?:)") - 1);
- Newx(RX_WRAPPED(rx), RXp_WRAPLEN(r) + 1, char );
- p = RX_WRAPPED(rx);
+ p = sv_grow(rx, RXp_WRAPLEN(r) + 1);
+ SvCUR_set(rx, RXp_WRAPLEN(r));
+ SvPOK_on(rx);
*p++='('; *p++='?';
if (has_p)
*p++ = KEEPCOPY_PAT_MOD; /*'p'*/
CALLREGFREE_PVT(rx); /* free the private data */
if (r->paren_names)
SvREFCNT_dec(r->paren_names);
- Safefree(RX_WRAPPED(rx));
}
if (r->substrs) {
if (r->anchored_substr)
register const I32 npar = r->nparens+1;
(void)ReREFCNT_inc(rx);
/* FIXME ORANGE (once we start actually using the regular SV fields.) */
+ /* We can take advantage of the existing "copied buffer" mechanism in SVs
+ by pointing directly at the buffer, but flagging that the allocated
+ space in the copy is zero. As we've just done a struct copy, it's now
+ a case of zero-ing that, rather than copying the current length. */
+ SvPV_set(ret_x, RX_WRAPPED(rx));
StructCopy(r, ret, regexp);
+ SvLEN_set(ret_x, 0);
Newx(ret->offs, npar, regexp_paren_pair);
Copy(r->offs, ret->offs, npar, regexp_paren_pair);
if (r->substrs) {
}
}
- RXp_WRAPPED(ret) = SAVEPVN(RXp_WRAPPED(ret), RXp_WRAPLEN(ret)+1);
ret->paren_names = hv_dup_inc(ret->paren_names, param);
if (ret->pprivate)
/* Information about the match that isn't often used */
- /* wrapped can't be const char*, as it is returned by sv_2pv_flags */
- char *wrapped; /* wrapped version of the pattern */
I32 wraplen; /* length of wrapped */
unsigned pre_prefix:4; /* offset from wrapped to the start of precomp */
unsigned seen_evals:28; /* number of eval groups in the pattern - for security checks */
#define RXp_EXTFLAGS(rx) ((rx)->extflags)
/* For source compatibility. We used to store these explicitly. */
-#define RX_PRECOMP(prog) (((struct regexp *)SvANY(prog))->wrapped + ((struct regexp *)SvANY(prog))->pre_prefix)
+#define RX_PRECOMP(prog) (RX_WRAPPED(prog) + ((struct regexp *)SvANY(prog))->pre_prefix)
#define RX_PRELEN(prog) RXp_PRELEN((struct regexp *)SvANY(prog))
-#define RX_WRAPPED(prog) (((struct regexp *)SvANY(prog))->wrapped)
+#define RX_WRAPPED(prog) SvPVX(prog)
#define RX_WRAPLEN(prog) RXp_WRAPLEN((struct regexp *)SvANY(prog))
#define RX_CHECK_SUBSTR(prog) (((struct regexp *)SvANY(prog))->check_substr)
#define RX_EXTFLAGS(prog) RXp_EXTFLAGS((struct regexp *)SvANY(prog))