Skip to content

Commit e6954d8

Browse files
committed
utf8_to_uv_msgs: Use a single bit flag
This condition used a combination of two bits, which makes things a little awkward, and isn't really needed
1 parent f174f6e commit e6954d8

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

utf8.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,17 +2092,13 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
20922092
case UTF8_GOT_LONG:
20932093
*errors |= UTF8_GOT_LONG;
20942094

2095-
if (flags & UTF8_ALLOW_LONG) {
2096-
2097-
/* We don't allow the actual overlong value, unless the
2098-
* special extra bit is also set */
2099-
if (! (flags & ( UTF8_ALLOW_LONG_AND_ITS_VALUE
2100-
& ~UTF8_ALLOW_LONG)))
2101-
{
2102-
uv = UNICODE_REPLACEMENT;
2103-
}
2095+
if (! (flags & UTF8_ALLOW_LONG_AND_ITS_VALUE)) {
2096+
uv = UNICODE_REPLACEMENT;
21042097
}
2105-
else {
2098+
2099+
if (! (flags & ( UTF8_ALLOW_LONG
2100+
|UTF8_ALLOW_LONG_AND_ITS_VALUE)))
2101+
{
21062102
disallowed = TRUE;
21072103

21082104
if (NEED_MESSAGE(WARN_UTF8,,)) {

utf8.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ point's representation.
12011201
* First one will convert the overlong to the REPLACEMENT CHARACTER; second
12021202
* will return what the overlong evaluates to */
12031203
#define UTF8_ALLOW_LONG 0x2000
1204-
#define UTF8_ALLOW_LONG_AND_ITS_VALUE (UTF8_ALLOW_LONG|0x4000)
1204+
#define UTF8_ALLOW_LONG_AND_ITS_VALUE 0x4000
12051205
#define UTF8_GOT_LONG UTF8_ALLOW_LONG
12061206

12071207
/* For back compat, these old names are misleading for overlongs and

0 commit comments

Comments
 (0)