summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2012-06-03 18:05:36 +0100
committerDavid Mitchell <davem@iabyn.com>2012-06-13 13:32:55 +0100
commite41ffe51c12c0cad6aa835df69c2ea84774bb0df (patch)
tree098673d5fd739461f29e35b06f0fde93768599c9 /regexec.c
parent197e8e6e210c7569f577deaefd83e24f1bdb0138 (diff)
downloadperl-e41ffe51c12c0cad6aa835df69c2ea84774bb0df.tar.gz
simplify the return code in (??{})
In the case where (??{...}) returns a non-reference with SMG, there are two branches: if it has GMG too, we assert it hasn't got PERL_MAGIC_qr, thus (intentionally) making redundant the following sv_unmagic(ret, PERL_MAGIC_qr); otherwise we mg_find(ret, PERL_MAGIC_qr) it. This can all be reduced to a single mg_find() with no change in code logic.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/regexec.c b/regexec.c
index 09693799b1..9155de82e5 100644
--- a/regexec.c
+++ b/regexec.c
@@ -4443,20 +4443,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
} else if (SvTYPE(ret) == SVt_REGEXP) {
rx = (REGEXP*) ret;
} else if (SvSMAGICAL(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 {
- 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 */
- }
+ mg = mg_find(ret, PERL_MAGIC_qr);
}
if (mg) {