Skip to content

Commit dd0471c

Browse files
committed
Turn is_utf8_common() into a macro
This function is now trivial; no need to have it a function
1 parent 3af31f1 commit dd0471c

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

embed.fnc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6111,9 +6111,6 @@ RTi |int |does_utf8_overflow \
61116111
|NN const U8 *e
61126112
RTi |int |isFF_overlong |NN const U8 * const s \
61136113
|const STRLEN len
6114-
Ri |bool |is_utf8_common |NN const U8 * const p \
6115-
|NN const U8 * const e \
6116-
|NN SV * const invlist
61176114
RTi |int |is_utf8_overlong \
61186115
|NN const U8 * const s \
61196116
|const STRLEN len

embed.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,6 @@
17811781
# define check_locale_boundary_crossing(a,b,c,d) S_check_locale_boundary_crossing(aTHX_ a,b,c,d)
17821782
# define does_utf8_overflow S_does_utf8_overflow
17831783
# define isFF_overlong S_isFF_overlong
1784-
# define is_utf8_common(a,b,c) S_is_utf8_common(aTHX_ a,b,c)
17851784
# define is_utf8_overlong S_is_utf8_overlong
17861785
# define new_msg_hv(a,b,c) S_new_msg_hv(aTHX_ a,b,c)
17871786
# define to_case_cp_list(a,b,c,d,e,f,g,h) S_to_case_cp_list(aTHX_ a,b,c,d,e,f,g,h)

proto.h

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

utf8.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3880,20 +3880,6 @@ Perl__to_uni_fold_flags(pTHX_ UV c, U8* p, STRLEN *lenp, U8 flags)
38803880
}
38813881
}
38823882

3883-
PERL_STATIC_INLINE bool
3884-
S_is_utf8_common(pTHX_ const U8 *const p, const U8 * const e,
3885-
SV* const invlist)
3886-
{
3887-
PERL_ARGS_ASSERT_IS_UTF8_COMMON;
3888-
3889-
/* returns a boolean giving whether or not the UTF8-encoded character that
3890-
* starts at <p>, and extending no further than <e - 1> is in the inversion
3891-
* list <invlist>. */
3892-
3893-
UV cp = utf8_to_uv_or_die(p, e, NULL);
3894-
return _invlist_contains_cp(invlist, cp);
3895-
}
3896-
38973883
#if 0 /* Not currently used, but may be needed in the future */
38983884
PERLVAR(I, seen_deprecated_macro, HV *)
38993885

@@ -3941,28 +3927,34 @@ S_warn_on_first_deprecated_use(pTHX_ U32 category,
39413927
}
39423928
#endif
39433929

3930+
/* returns a boolean giving whether or not the UTF8-encoded character that
3931+
* starts at <p>, and extending no further than <e - 1> is in the inversion
3932+
* list <invlist>. */
3933+
#define IS_UTF8_IN_INVLIST(p, e, invlist) \
3934+
_invlist_contains_cp(invlist, utf8_to_uv_or_die(p, e, NULL))
3935+
39443936
bool
39453937
Perl__is_utf8_FOO(pTHX_ const U8 classnum, const U8 *p, const U8 * const e)
39463938
{
39473939
PERL_ARGS_ASSERT__IS_UTF8_FOO;
39483940

3949-
return is_utf8_common(p, e, PL_XPosix_ptrs[classnum]);
3941+
return IS_UTF8_IN_INVLIST(p, e, PL_XPosix_ptrs[classnum]);
39503942
}
39513943

39523944
bool
39533945
Perl__is_utf8_perl_idstart(pTHX_ const U8 *p, const U8 * const e)
39543946
{
39553947
PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART;
39563948

3957-
return is_utf8_common(p, e, PL_utf8_perl_idstart);
3949+
return IS_UTF8_IN_INVLIST(p, e, PL_utf8_perl_idstart);
39583950
}
39593951

39603952
bool
39613953
Perl__is_utf8_perl_idcont(pTHX_ const U8 *p, const U8 * const e)
39623954
{
39633955
PERL_ARGS_ASSERT__IS_UTF8_PERL_IDCONT;
39643956

3965-
return is_utf8_common(p, e, PL_utf8_perl_idcont);
3957+
return IS_UTF8_IN_INVLIST(p, e, PL_utf8_perl_idcont);
39663958
}
39673959

39683960
STATIC UV

0 commit comments

Comments
 (0)