Skip to content

Commit 626cad2

Browse files
committed
utf8.c: Further simplify a complex conditional
This hoists a clause in a complex conditional to the 'if' statement above it, converting that to two conditionals from one, while decreasing the number in the much larger interior 'if' by 1. This is in preparation for further simplifications in the next few commits.
1 parent 98aa7cc commit 626cad2

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

utf8.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,19 +1593,18 @@ 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+
1599+
/* if overflow, we know without looking further that this
1600+
* is a non-Unicode code point, which we deal with below in
1601+
* the overflow handling code */
1602+
&& LIKELY(! (possible_problems & UTF8_GOT_OVERFLOW)))
15981603
{
15991604
/* uv is valid for overlongs */
16001605
if ( ( LIKELY(! (possible_problems & ~UTF8_GOT_LONG))
16011606
&& isUNICODE_POSSIBLY_PROBLEMATIC(uv))
16021607
|| ( UNLIKELY(possible_problems)
1603-
1604-
/* if overflow, we know without looking further
1605-
* precisely which of the problematic types it is,
1606-
* and we deal with those in the overflow handling
1607-
* code */
1608-
&& LIKELY(! (possible_problems & UTF8_GOT_OVERFLOW))
16091608
&& ( isUTF8_POSSIBLY_PROBLEMATIC(*adjusted_s0)
16101609
|| UNLIKELY(UTF8_IS_PERL_EXTENDED(s0)))))
16111610
{

0 commit comments

Comments
 (0)