Skip to content

Commit c347076

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 0a7924e commit c347076

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
@@ -3004,10 +3004,10 @@ Perl_utf8n_to_uvchr_msgs(const U8 * const s0,
30043004
#ifdef PERL_CORE
30053005
assert(curlen > 0);
30063006
#else
3007-
if (UNLIKELY(curlen == 0)) return _utf8n_to_uvchr_msgs_helper(s0, 0, retlen,
3008-
flags, errors, msgs);
3007+
if (LIKELY(curlen > 0))
30093008
#endif
30103009

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

30563056
return UNI_TO_NATIVE(uv);
30573057
}
3058+
}
30583059

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

0 commit comments

Comments
 (0)