summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2018-01-19 12:01:56 +0000
committerDavid Mitchell <davem@iabyn.com>2018-01-19 13:47:39 +0000
commitaae634e7e53e95647c40734059a045c1e0a25c7b (patch)
tree1017a241beb0785998b0fe25a8b9d065095d10e7 /op.c
parenta11063347569002659e0731085217d0bc0347971 (diff)
downloadperl-aae634e7e53e95647c40734059a045c1e0a25c7b.tar.gz
tr/nonutf8/nonutf8/c: simplify GROW calc
When, for each slot, deciding whether to set OPpTRANS_GROWS, the calculation is only done in one of 4 possible branches. It turns out that in the other branches, the condition can never be true; but determining that is subtle, and the assumption might break for future changes. Move the test outside the if/else tree so it can be seen to always apply. So in theory this commit makes no function difference.
Diffstat (limited to 'op.c')
-rw-r--r--op.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/op.c b/op.c
index 4ea83d172c..7f4618b784 100644
--- a/op.c
+++ b/op.c
@@ -6660,10 +6660,13 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
tbl->map[i] = (short)i;
}
else {
- if (UVCHR_IS_INVARIANT(i) && ! UVCHR_IS_INVARIANT(r[j]))
- grows = 1;
tbl->map[i] = r[j++];
}
+ if ( tbl->map[i] >= 0
+ && UVCHR_IS_INVARIANT((UV)i)
+ && !UVCHR_IS_INVARIANT((UV)(tbl->map[i]))
+ )
+ grows = 1;
}
}