in tr/search/replace/c, the number of 'paired' replacement chars
will always be <= length(replace). Assert this, and thus simplify a couple
of conditionals from >= to ==.
It should make no difference to execution, but reduces the cognitive
load.
tbl[t[i]] = -1;
for (i = 0, j = 0; i < 256; i++) {
if (!tbl[i]) {
tbl[t[i]] = -1;
for (i = 0, j = 0; i < 256; i++) {
if (!tbl[i]) {
if (del)
tbl[i] = -2;
else if (rlen)
if (del)
tbl[i] = -2;
else if (rlen)
+
+ assert(j <= (I32)rlen);
if (!del) {
if (!rlen) {
/* empty replacement list */
if (!del) {
if (!rlen) {
/* empty replacement list */
if (!squash)
o->op_private |= OPpTRANS_IDENTICAL;
}
if (!squash)
o->op_private |= OPpTRANS_IDENTICAL;
}
- else if (j >= (I32)rlen)
+ else if (j == (I32)rlen)
/* no more replacement chars than search chars */
j = rlen - 1;
else {
/* no more replacement chars than search chars */
j = rlen - 1;
else {