Skip to content

Commit bf462a1

Browse files
committed
is_utf8_common: Use utf8_to_uv()
This is the preferred function
1 parent 00f06a3 commit bf462a1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

utf8.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3725,15 +3725,14 @@ PERL_STATIC_INLINE bool
37253725
S_is_utf8_common(pTHX_ const U8 *const p, const U8 * const e,
37263726
SV* const invlist)
37273727
{
3728+
PERL_ARGS_ASSERT_IS_UTF8_COMMON;
3729+
37283730
/* returns a boolean giving whether or not the UTF8-encoded character that
37293731
* starts at <p>, and extending no further than <e - 1> is in the inversion
37303732
* list <invlist>. */
37313733

3732-
UV cp = utf8n_to_uvchr(p, e - p, NULL, 0);
3733-
3734-
PERL_ARGS_ASSERT_IS_UTF8_COMMON;
3735-
3736-
if (cp == 0 && (p >= e || *p != '\0')) {
3734+
UV cp;
3735+
if (! utf8_to_uv(p, e, &cp, NULL)) {
37373736
_force_out_malformed_utf8_message(p, e, 0, MALFORMED_UTF8_DIE);
37383737
NOT_REACHED; /* NOTREACHED */
37393738
}

0 commit comments

Comments
 (0)