Allow sv_setsv_flags() to copy SVt_REGEXP much like it copies
authorNicholas Clark <nick@ccl4.org>
Sun, 6 Jan 2008 00:23:23 +0000 (00:23 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 6 Jan 2008 00:23:23 +0000 (00:23 +0000)
SVt_FORMAT - the just string buffer.

p4raw-id: //depot/perl@32863

ext/re/re.xs
sv.c

index 1de1491..ccf8ca0 100644 (file)
@@ -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 (file)
--- 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);