Skip to content

Commit 704b783

Browse files
committed
utf8n_to_uvchr_msgs: Refactor to avoid extra call
This makes a complicated function call appear in the source just once.
1 parent 212e7e8 commit 704b783

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

inline.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,10 +3005,10 @@ Perl_utf8n_to_uvchr_msgs(const U8 * const s0,
30053005
#ifdef PERL_CORE
30063006
assert(curlen > 0);
30073007
#else
3008-
if (UNLIKELY(curlen == 0)) return _utf8n_to_uvchr_msgs_helper(s0, 0, retlen,
3009-
flags, errors, msgs);
3008+
if (LIKELY(curlen > 0))
30103009
#endif
30113010

3011+
{
30123012
/* UTF-8 invariants are returned unchanged. The code below is quite
30133013
* capable of handling this, but this shortcuts this very common case
30143014
* */
@@ -3056,6 +3056,7 @@ Perl_utf8n_to_uvchr_msgs(const U8 * const s0,
30563056

30573057
return UNI_TO_NATIVE(uv);
30583058
}
3059+
}
30593060

30603061
/* Here is potentially problematic. Use the full mechanism */
30613062
return _utf8n_to_uvchr_msgs_helper(s0, curlen, retlen, flags,

0 commit comments

Comments
 (0)