Skip to content

Commit 98aa7cc

Browse files
committed
utf8.c: Split conditionals
As a first step in simplifying this overly complicated series of conditionals, pull out the first one into a separate 'if'. The next commits will do more.
1 parent c082b7f commit 98aa7cc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

utf8.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,10 +1593,11 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
15931593
/* Here, we have found all the possible problems, except for when the input
15941594
* is for a problematic code point not allowed by the input parameters.
15951595
* Check now for those parameters */
1596-
if ( (flags & ( UTF8_DISALLOW_ILLEGAL_INTERCHANGE
1597-
|UTF8_WARN_ILLEGAL_INTERCHANGE))
1596+
if (flags & ( UTF8_DISALLOW_ILLEGAL_INTERCHANGE
1597+
|UTF8_WARN_ILLEGAL_INTERCHANGE))
1598+
{
15981599
/* uv is valid for overlongs */
1599-
&& ( ( LIKELY(! (possible_problems & ~UTF8_GOT_LONG))
1600+
if ( ( LIKELY(! (possible_problems & ~UTF8_GOT_LONG))
16001601
&& isUNICODE_POSSIBLY_PROBLEMATIC(uv))
16011602
|| ( UNLIKELY(possible_problems)
16021603

@@ -1606,8 +1607,8 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
16061607
* code */
16071608
&& LIKELY(! (possible_problems & UTF8_GOT_OVERFLOW))
16081609
&& ( isUTF8_POSSIBLY_PROBLEMATIC(*adjusted_s0)
1609-
|| UNLIKELY(UTF8_IS_PERL_EXTENDED(s0))))))
1610-
{
1610+
|| UNLIKELY(UTF8_IS_PERL_EXTENDED(s0)))))
1611+
{
16111612
/* If there were no malformations, or the only malformation is an
16121613
* overlong, 'uv' is valid */
16131614
if (LIKELY(! (possible_problems & ~UTF8_GOT_LONG))) {
@@ -1645,6 +1646,7 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
16451646
/* We need a complete well-formed UTF-8 character to discern
16461647
* non-characters, so can't look for them here */
16471648
}
1649+
}
16481650
}
16491651

16501652
ready_to_handle_errors:

0 commit comments

Comments
 (0)