diff options
author | David Mitchell <davem@iabyn.com> | 2018-01-19 12:01:56 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-01-19 13:47:39 +0000 |
commit | aae634e7e53e95647c40734059a045c1e0a25c7b (patch) | |
tree | 1017a241beb0785998b0fe25a8b9d065095d10e7 /op.c | |
parent | a11063347569002659e0731085217d0bc0347971 (diff) | |
download | perl-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.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } } |