diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-12-27 17:22:06 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-12-27 17:22:06 +0000 |
commit | 124ee91afb4a0db86a0ab6e7348e1f97ae18fc0d (patch) | |
tree | 88a1c4eb671f3bb8cc946a2428aad700533a55d6 /regexec.c | |
parent | eedd3f9945d88d04a9b05b404d586f13ef6c2298 (diff) | |
download | perl-124ee91afb4a0db86a0ab6e7348e1f97ae18fc0d.tar.gz |
assert() that the sv_unmagic() in S_regmatch() is unneeded.
Add a comment about the mg_find() that follows.
p4raw-id: //depot/perl@32742
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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) { |