summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-03-02 11:23:54 +0000
committerDavid Mitchell <davem@iabyn.com>2016-03-02 11:23:54 +0000
commit106d9a1395da59dd83d959b4c7be8a042af5268d (patch)
treef4ee5437ec8b4edd1be7d66f5f85557c8e6bfbfb /pp_hot.c
parent927111045d2064fd97eb5e9097dab8a19e639997 (diff)
downloadperl-106d9a1395da59dd83d959b4c7be8a042af5268d.tar.gz
pp_subst(): rename local var
make it clear that is_cow represents the original COW state (which may not be the current state when checked later), by renaming it to was_cow.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 1a194a9369..d7fa3d26da 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2892,7 +2892,7 @@ PP(pp_subst)
STRLEN slen;
bool doutf8 = FALSE; /* whether replacement is in utf8 */
#ifdef PERL_ANY_COW
- bool is_cow;
+ bool was_cow;
#endif
SV *nsv = NULL;
/* known replacement string? */
@@ -2911,7 +2911,8 @@ PP(pp_subst)
SvGETMAGIC(TARG); /* must come before cow check */
#ifdef PERL_ANY_COW
- is_cow = cBOOL(SvIsCOW(TARG));
+ /* note that a string might get converted to COW during matching */
+ was_cow = cBOOL(SvIsCOW(TARG));
#endif
if (!(rpm->op_pmflags & PMf_NONDESTRUCT)) {
#ifndef PERL_ANY_COW
@@ -3013,7 +3014,7 @@ PP(pp_subst)
/* can do inplace substitution? */
if (c
#ifdef PERL_ANY_COW
- && !is_cow
+ && !was_cow
#endif
&& (I32)clen <= RX_MINLENRET(rx)
&& ( once
@@ -3026,6 +3027,7 @@ PP(pp_subst)
{
#ifdef PERL_ANY_COW
+ /* string might have got converted to COW since we set was_cow */
if (SvIsCOW(TARG)) {
if (!force_on_match)
goto have_a_cow;