summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorAdrian M. Enache <enache@rdslink.ro>2003-02-23 22:16:39 +0200
committerhv <hv@crypt.org>2003-02-26 01:36:49 +0000
commitfaf82a0b75a45f1e4dbb7ad8cecdfaf9a30a643d (patch)
tree45806f716e73d5c78d51d8ebfa55b86f394c9f0a /regexec.c
parentbd5cf8491554ab1313db72afbf9e7bc1debe967c (diff)
downloadperl-faf82a0b75a45f1e4dbb7ad8cecdfaf9a30a643d.tar.gz
Re: [perl #20683] [fix] Better Patch
Message-ID: <20030223181639.GA18713@ratsnest.hole> p4raw-id: //depot/perl@18782
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/regexec.c b/regexec.c
index 4135d3622f..ebe7883b60 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2867,13 +2867,17 @@ S_regmatch(pTHX_ regnode *prog)
re_cc_state state;
CHECKPOINT cp, lastcp;
int toggleutf;
+ register SV *sv;
- if(SvROK(ret) || SvRMAGICAL(ret)) {
- SV *sv = SvROK(ret) ? SvRV(ret) : ret;
-
- if(SvMAGICAL(sv))
- mg = mg_find(sv, PERL_MAGIC_qr);
+ if(SvROK(ret) && SvSMAGICAL(sv = SvRV(ret)))
+ mg = mg_find(sv, PERL_MAGIC_qr);
+ else if (SvSMAGICAL(ret)) {
+ if (SvGMAGICAL(ret))
+ sv_unmagic(ret, PERL_MAGIC_qr);
+ else
+ mg = mg_find(ret, PERL_MAGIC_qr);
}
+
if (mg) {
re = (regexp *)mg->mg_obj;
(void)ReREFCNT_inc(re);
@@ -2890,7 +2894,8 @@ S_regmatch(pTHX_ regnode *prog)
if (DO_UTF8(ret)) pm.op_pmdynflags |= PMdf_DYN_UTF8;
re = CALLREGCOMP(aTHX_ t, t + len, &pm);
if (!(SvFLAGS(ret)
- & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)))
+ & (SVs_TEMP | SVs_PADTMP | SVf_READONLY
+ | SVs_GMG)))
sv_magic(ret,(SV*)ReREFCNT_inc(re),
PERL_MAGIC_qr,0,0);
PL_regprecomp = oprecomp;