Skip to content

Commit c082b7f

Browse files
committed
utf8.c: Move most important conditional to be first
It turns out that the information generated in this block is only needed if the final conditional in this complicated group of them is true, which checks if the caller wants anything special for certain classes of code points. Because that final condition is subsidiary, the block was getting executed just to be thrown away.
1 parent 76771a3 commit c082b7f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

utf8.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,10 +1591,12 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
15911591
}
15921592

15931593
/* Here, we have found all the possible problems, except for when the input
1594-
* is for a problematic code point not allowed by the input parameters. */
1595-
1594+
* is for a problematic code point not allowed by the input parameters.
1595+
* Check now for those parameters */
1596+
if ( (flags & ( UTF8_DISALLOW_ILLEGAL_INTERCHANGE
1597+
|UTF8_WARN_ILLEGAL_INTERCHANGE))
15961598
/* uv is valid for overlongs */
1597-
if ( ( ( LIKELY(! (possible_problems & ~UTF8_GOT_LONG))
1599+
&& ( ( LIKELY(! (possible_problems & ~UTF8_GOT_LONG))
15981600
&& isUNICODE_POSSIBLY_PROBLEMATIC(uv))
15991601
|| ( UNLIKELY(possible_problems)
16001602

@@ -1604,9 +1606,7 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
16041606
* code */
16051607
&& LIKELY(! (possible_problems & UTF8_GOT_OVERFLOW))
16061608
&& ( isUTF8_POSSIBLY_PROBLEMATIC(*adjusted_s0)
1607-
|| UNLIKELY(UTF8_IS_PERL_EXTENDED(s0)))))
1608-
&& ((flags & ( UTF8_DISALLOW_ILLEGAL_INTERCHANGE
1609-
|UTF8_WARN_ILLEGAL_INTERCHANGE))))
1609+
|| UNLIKELY(UTF8_IS_PERL_EXTENDED(s0))))))
16101610
{
16111611
/* If there were no malformations, or the only malformation is an
16121612
* overlong, 'uv' is valid */

0 commit comments

Comments
 (0)