summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-27 17:22:06 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-27 17:22:06 +0000
commit124ee91afb4a0db86a0ab6e7348e1f97ae18fc0d (patch)
tree88a1c4eb671f3bb8cc946a2428aad700533a55d6 /regexec.c
parenteedd3f9945d88d04a9b05b404d586f13ef6c2298 (diff)
downloadperl-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.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index 634844bde0..f932d17ec8 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) {