This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
manually apply patch with a dependency on unapplied patch
authorIlya Zakharevich <ilya@math.berkeley.edu>
Wed, 8 Jul 1998 07:03:51 +0000 (03:03 -0400)
committerGurusamy Sarathy <gsar@cpan.org>
Thu, 9 Jul 1998 01:06:47 +0000 (01:06 +0000)
Message-Id: <199807081103.HAA25145@monk.mps.ohio-state.edu>
Subject: [PATCH 5.004_70] make quoted RE embeddable

p4raw-id: //depot/perl@1383

sv.c
t/op/pat.t

diff --git a/sv.c b/sv.c
index 60972b4..b462127 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1706,10 +1706,18 @@ sv_2pv(register SV *sv, STRLEN *lp)
                          == (SVs_OBJECT|SVs_RMG))
                         && strEQ(s=HvNAME(SvSTASH(sv)), "Regexp")
                         && (mg = mg_find(sv, 'r'))) {
-                       regexp *re = (regexp *)mg->mg_obj;
-
-                       *lp = re->prelen;
-                       return re->precomp;
+                       if (!mg->mg_ptr) {
+                           regexp *re = (regexp *)mg->mg_obj;
+
+                           mg->mg_len = re->prelen + 4;
+                           New(616, mg->mg_ptr, mg->mg_len + 1, char);
+                           Copy("(?:", mg->mg_ptr, 3, char);
+                           Copy(re->precomp, mg->mg_ptr+3, re->prelen, char);
+                           mg->mg_ptr[mg->mg_len - 1] = ')';
+                           mg->mg_ptr[mg->mg_len] = 0;
+                       }
+                       *lp = mg->mg_len;
+                       return mg->mg_ptr;
                    }
                                        /* Fall through */
                case SVt_NULL:
index 7ee1f09..a4335b0 100755 (executable)
@@ -440,7 +440,7 @@ print "ok $test\n";
 $test++;
 
 # This should be changed to qr/\b\v$/ ASAP
-print "not " unless study(/\b\v$/) eq '\bv$';
+print "not " unless study(/\b\v$/) eq '(?:\bv$)';
 print "ok $test\n";
 $test++;