diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-06-16 11:11:39 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-16 11:16:54 +0200 |
commit | 77da2310c76f19f8b52c04ab613265ef345523a1 (patch) | |
tree | 1296f141ac47be07c76a142ba19b756e0abebd3b | |
parent | ecb73272e6394b45dd79d2330a67e279ab136980 (diff) | |
download | perl-77da2310c76f19f8b52c04ab613265ef345523a1.tar.gz |
In pp_match, refactor the call to CALLREGEXEC() to avoid a goto.
The previous slightly contorted logic had an if() block that ended in a goto,
where the target was only 6 lines later, and could not be reached directly.
It dates back to (at least) 5.000, with no structural changes since then.
-rw-r--r-- | pp_hot.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -1404,22 +1404,18 @@ PP(pp_match) && !SvROK(TARG)) /* Cannot trust since INTUIT cannot guess ^ */ goto yup; } - if (CALLREGEXEC(rx, (char*)s, (char *)strend, (char*)truebase, - minmatch, TARG, NUM2PTR(void*, gpos), r_flags)) - { - PL_curpm = pm; - if (dynpm->op_pmflags & PMf_ONCE) { + if (!CALLREGEXEC(rx, (char*)s, (char *)strend, (char*)truebase, + minmatch, TARG, NUM2PTR(void*, gpos), r_flags)) + goto ret_no; + + PL_curpm = pm; + if (dynpm->op_pmflags & PMf_ONCE) { #ifdef USE_ITHREADS - SvREADONLY_on(PL_regex_pad[dynpm->op_pmoffset]); + SvREADONLY_on(PL_regex_pad[dynpm->op_pmoffset]); #else - dynpm->op_pmflags |= PMf_USED; + dynpm->op_pmflags |= PMf_USED; #endif - } - goto gotcha; } - else - goto ret_no; - /*NOTREACHED*/ gotcha: if (rxtainted) |