Renew(s,newlen,char);
}
else {
- /* If we're growing a newSVpvn_share()d SV, we must unshare
- the PVX by hand, since sv_force_normal_flags() will try
- to grow the SV. AMS 20010713 */
+ /* sv_force_normal_flags() must not try to unshare the new
+ PVX we allocate below. AMS 20010713 */
if (SvREADONLY(sv) && SvFAKE(sv)) {
- STRLEN len = SvCUR(sv);
SvFAKE_off(sv);
SvREADONLY_off(sv);
- unsharepvn(SvPVX(sv), SvUTF8(sv) ? -(I32)len : len, SvUVX(sv));
}
New(703, s, newlen, char);
}
if (cur1 && cur2 && SvUTF8(sv1) != SvUTF8(sv2) && !IN_BYTES) {
bool is_utf8 = TRUE;
/* UTF-8ness differs */
- if (PL_hints & HINT_UTF8_DISTINCT)
- return FALSE;
if (SvUTF8(sv1)) {
/* sv1 is the UTF-8 one , If is equal it must be downgrade-able */
/* do not utf8ize the comparands as a side-effect */
if (cur1 && cur2 && SvUTF8(sv1) != SvUTF8(sv2) && !IN_BYTES) {
- if (PL_hints & HINT_UTF8_DISTINCT)
- return SvUTF8(sv1) ? 1 : -1;
-
if (SvUTF8(sv1)) {
pv2 = (char*)bytes_to_utf8((U8*)pv2, &cur2);
pv2tmp = TRUE;
register SV *sv;
bool is_utf8 = FALSE;
if (len < 0) {
- len = -len;
+ STRLEN tmplen = -len;
is_utf8 = TRUE;
- }
- if (is_utf8 && !(PL_hints & HINT_UTF8_DISTINCT)) {
- STRLEN tmplen = len;
/* See the note in hv.c:hv_fetch() --jhi */
src = (char*)bytes_from_utf8((U8*)src, &tmplen, &is_utf8);
len = tmplen;
New(0, ret->endp, npar, I32);
Copy(r->startp, ret->startp, npar, I32);
- if (r->regstclass) {
- New(0, ret->regstclass, 1, regnode);
- ret->regstclass->flags = r->regstclass->flags;
- }
- else
- ret->regstclass = NULL;
-
New(0, ret->substrs, 1, struct reg_substr_data);
for (s = ret->substrs->data, i = 0; i < 3; i++, s++) {
s->min_offset = r->substrs->data[i].min_offset;
s->substr = sv_dup_inc(r->substrs->data[i].substr, param);
}
+ ret->regstclass = NULL;
if (r->data) {
struct reg_data *d;
int count = r->data->count;
New(0, d->data[i], 1, struct regnode_charclass_class);
StructCopy(r->data->data[i], d->data[i],
struct regnode_charclass_class);
+ ret->regstclass = (regnode*)d->data[i];
break;
case 'o':
case 'n':
Copy(r->offsets, ret->offsets, 2*len+1, U32);
ret->precomp = SAVEPV(r->precomp);
- ret->subbeg = SAVEPV(r->subbeg);
- ret->sublen = r->sublen;
ret->refcnt = r->refcnt;
ret->minlen = r->minlen;
ret->prelen = r->prelen;
ret->lastcloseparen = r->lastcloseparen;
ret->reganch = r->reganch;
+ ret->sublen = r->sublen;
+
+ if (RX_MATCH_COPIED(ret))
+ ret->subbeg = SAVEPV(r->subbeg);
+ else
+ ret->subbeg = Nullch;
+
ptr_table_store(PL_ptr_table, r, ret);
return ret;
}