From: Nicholas Clark Date: Thu, 27 Dec 2007 17:22:06 +0000 (+0000) Subject: assert() that the sv_unmagic() in S_regmatch() is unneeded. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=124ee91afb4a0db86a0ab6e7348e1f97ae18fc0d;p=p5sagit%2Fp5-mst-13.2.git assert() that the sv_unmagic() in S_regmatch() is unneeded. Add a comment about the mg_find() that follows. p4raw-id: //depot/perl@32742 --- diff --git a/regexec.c b/regexec.c index 634844b..f932d17 100644 --- a/regexec.c +++ b/regexec.c @@ -3713,10 +3713,20 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog) if(SvROK(ret) && SvSMAGICAL(sv = SvRV(ret))) mg = mg_find(sv, PERL_MAGIC_qr); else if (SvSMAGICAL(ret)) { - if (SvGMAGICAL(ret)) + if (SvGMAGICAL(ret)) { + /* I don't believe that there is ever qr magic + here. */ + assert(!mg_find(ret, PERL_MAGIC_qr)); sv_unmagic(ret, PERL_MAGIC_qr); - else + } + else { mg = mg_find(ret, PERL_MAGIC_qr); + /* testing suggests mg only ends up non-NULL for + scalars who were upgraded and compiled in the + else block below. In turn, this is only + triggered in the "postponed utf8 string" tests + in t/op/pat.t */ + } } if (mg) {