From: Nicholas Clark Date: Sun, 6 Jan 2008 00:23:23 +0000 (+0000) Subject: Allow sv_setsv_flags() to copy SVt_REGEXP much like it copies X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fd44068c47d5f6a98ba4bc0096f3f1de992385b6;p=p5sagit%2Fp5-mst-13.2.git Allow sv_setsv_flags() to copy SVt_REGEXP much like it copies SVt_FORMAT - the just string buffer. p4raw-id: //depot/perl@32863 --- diff --git a/ext/re/re.xs b/ext/re/re.xs index 1de1491..ccf8ca0 100644 --- a/ext/re/re.xs +++ b/ext/re/re.xs @@ -128,9 +128,13 @@ PPCODE: } else { /* Scalar, so use the string that Perl would return */ /* return the pattern in (?msix:..) format */ +#if PERL_VERSION >= 11 + pattern = sv_2mortal(newSVsv((SV*)re)); +#else pattern = sv_2mortal(newSVpvn(RX_WRAPPED(re),RX_WRAPLEN(re))); if (RX_UTF8(re)) SvUTF8_on(pattern); +#endif XPUSHs(pattern); XSRETURN(1); } diff --git a/sv.c b/sv.c index b5ee77e..b99d937 100644 --- a/sv.c +++ b/sv.c @@ -3499,6 +3499,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) } /* Fall through */ #endif + case SVt_REGEXP: case SVt_PV: if (dtype < SVt_PV) sv_upgrade(dstr, SVt_PV);