lcUTF8: remove two unneeded ifs and two elses that are never reached

When there is a break at the end of the while loop, it means that the
loop will finish the first time that _XlcGetCharSetWithSide() returns
a non-NULL result, which means that the first '(last_charset == NULL)'
will always be true and the else part is redundant.

Fixes issue #46.

Reported-by: Bhavi Dhingra

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
This commit is contained in:
Benno Schulenberg 2022-01-12 11:34:23 +01:00 committed by Alan Coopersmith
parent 033f37d507
commit f15d2a01f7

View file

@ -742,20 +742,14 @@ utf8tocs1(
continue;
}
last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side);
if (last_charset == NULL) {
last_charset =
_XlcGetCharSetWithSide(chosen_charset->name, chosen_side);
if (last_charset == NULL) {
src += consumed;
unconv_num++;
continue;
}
} else {
if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name
&& (last_charset->side == XlcGLGR
|| last_charset->side == chosen_side)))
break;
src += consumed;
unconv_num++;
continue;
}
src += consumed;
dst += count;
break;
@ -1615,20 +1609,14 @@ wcstocs1(
continue;
}
last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side);
if (last_charset == NULL) {
last_charset =
_XlcGetCharSetWithSide(chosen_charset->name, chosen_side);
if (last_charset == NULL) {
src++;
unconv_num++;
continue;
}
} else {
if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name
&& (last_charset->side == XlcGLGR
|| last_charset->side == chosen_side)))
break;
src++;
unconv_num++;
continue;
}
src++;
dst += count;
break;