PL_regex_padav can simply be dup()ed. This is surprisingly satisfying.
Nicholas Clark [Tue, 8 Jan 2008 17:35:19 +0000 (17:35 +0000)]
p4raw-id: //depot/perl@32901

sv.c

diff --git a/sv.c b/sv.c
index c2b1e1e..9268e56 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11256,24 +11256,11 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_regmatch_slab   = NULL;
     
     /* Clone the regex array */
-    PL_regex_padav = newAV();
-    {
-       const I32 len = av_len((AV*)proto_perl->Iregex_padav);
-       SV* const * const regexen = AvARRAY((AV*)proto_perl->Iregex_padav);
-       IV i;
-       av_push(PL_regex_padav, sv_dup_inc_NN(regexen[0],param));
-       for(i = 1; i <= len; i++) {
-           const SV * const regex = regexen[i];
-           /* FIXME for plugins
-                       newSViv(PTR2IV(CALLREGDUPE(
-                               INT2PTR(REGEXP *, SvIVX(regex)), param))))
-           */
-           SV * const sv = sv_dup_inc((SV*) regex, param);
-           if (SvFLAGS(regex) & SVf_BREAK)
-               assert(SvFLAGS(sv) & SVf_BREAK); /* unrefcnted PL_curpm */
-           av_push(PL_regex_padav, sv);
-       }
-    }
+    /* ORANGE FIXME for plugins, probably in the SV dup code.
+       newSViv(PTR2IV(CALLREGDUPE(
+       INT2PTR(REGEXP *, SvIVX(regex)), param))))
+    */
+    PL_regex_padav = av_dup_inc(proto_perl->Iregex_padav, param);
     PL_regex_pad = AvARRAY(PL_regex_padav);
 
     /* shortcuts to various I/O objects */