mirror of
https://github.com/Perl/perl5.git
synced 2026-01-27 01:44:43 +00:00
Turn is_utf8_common() into a macro
This function is now trivial; no need to have it a function
This commit is contained in:
parent
3af31f1410
commit
dd0471ca54
@ -6111,9 +6111,6 @@ RTi |int |does_utf8_overflow \
|
||||
|NN const U8 *e
|
||||
RTi |int |isFF_overlong |NN const U8 * const s \
|
||||
|const STRLEN len
|
||||
Ri |bool |is_utf8_common |NN const U8 * const p \
|
||||
|NN const U8 * const e \
|
||||
|NN SV * const invlist
|
||||
RTi |int |is_utf8_overlong \
|
||||
|NN const U8 * const s \
|
||||
|const STRLEN len
|
||||
|
||||
1
embed.h
1
embed.h
@ -1781,7 +1781,6 @@
|
||||
# define check_locale_boundary_crossing(a,b,c,d) S_check_locale_boundary_crossing(aTHX_ a,b,c,d)
|
||||
# define does_utf8_overflow S_does_utf8_overflow
|
||||
# define isFF_overlong S_isFF_overlong
|
||||
# define is_utf8_common(a,b,c) S_is_utf8_common(aTHX_ a,b,c)
|
||||
# define is_utf8_overlong S_is_utf8_overlong
|
||||
# define new_msg_hv(a,b,c) S_new_msg_hv(aTHX_ a,b,c)
|
||||
# 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)
|
||||
|
||||
6
proto.h
generated
6
proto.h
generated
@ -9508,12 +9508,6 @@ S_isFF_overlong(const U8 * const s, const STRLEN len)
|
||||
# define PERL_ARGS_ASSERT_ISFF_OVERLONG \
|
||||
assert(s)
|
||||
|
||||
PERL_STATIC_INLINE bool
|
||||
S_is_utf8_common(pTHX_ const U8 * const p, const U8 * const e, SV * const invlist)
|
||||
__attribute__warn_unused_result__;
|
||||
# define PERL_ARGS_ASSERT_IS_UTF8_COMMON \
|
||||
assert(p); assert(e); assert(invlist)
|
||||
|
||||
PERL_STATIC_INLINE int
|
||||
S_is_utf8_overlong(const U8 * const s, const STRLEN len)
|
||||
__attribute__warn_unused_result__;
|
||||
|
||||
26
utf8.c
26
utf8.c
@ -3880,20 +3880,6 @@ Perl__to_uni_fold_flags(pTHX_ UV c, U8* p, STRLEN *lenp, U8 flags)
|
||||
}
|
||||
}
|
||||
|
||||
PERL_STATIC_INLINE bool
|
||||
S_is_utf8_common(pTHX_ const U8 *const p, const U8 * const e,
|
||||
SV* const invlist)
|
||||
{
|
||||
PERL_ARGS_ASSERT_IS_UTF8_COMMON;
|
||||
|
||||
/* returns a boolean giving whether or not the UTF8-encoded character that
|
||||
* starts at <p>, and extending no further than <e - 1> is in the inversion
|
||||
* list <invlist>. */
|
||||
|
||||
UV cp = utf8_to_uv_or_die(p, e, NULL);
|
||||
return _invlist_contains_cp(invlist, cp);
|
||||
}
|
||||
|
||||
#if 0 /* Not currently used, but may be needed in the future */
|
||||
PERLVAR(I, seen_deprecated_macro, HV *)
|
||||
|
||||
@ -3941,12 +3927,18 @@ S_warn_on_first_deprecated_use(pTHX_ U32 category,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* returns a boolean giving whether or not the UTF8-encoded character that
|
||||
* starts at <p>, and extending no further than <e - 1> is in the inversion
|
||||
* list <invlist>. */
|
||||
#define IS_UTF8_IN_INVLIST(p, e, invlist) \
|
||||
_invlist_contains_cp(invlist, utf8_to_uv_or_die(p, e, NULL))
|
||||
|
||||
bool
|
||||
Perl__is_utf8_FOO(pTHX_ const U8 classnum, const U8 *p, const U8 * const e)
|
||||
{
|
||||
PERL_ARGS_ASSERT__IS_UTF8_FOO;
|
||||
|
||||
return is_utf8_common(p, e, PL_XPosix_ptrs[classnum]);
|
||||
return IS_UTF8_IN_INVLIST(p, e, PL_XPosix_ptrs[classnum]);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -3954,7 +3946,7 @@ Perl__is_utf8_perl_idstart(pTHX_ const U8 *p, const U8 * const e)
|
||||
{
|
||||
PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART;
|
||||
|
||||
return is_utf8_common(p, e, PL_utf8_perl_idstart);
|
||||
return IS_UTF8_IN_INVLIST(p, e, PL_utf8_perl_idstart);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -3962,7 +3954,7 @@ Perl__is_utf8_perl_idcont(pTHX_ const U8 *p, const U8 * const e)
|
||||
{
|
||||
PERL_ARGS_ASSERT__IS_UTF8_PERL_IDCONT;
|
||||
|
||||
return is_utf8_common(p, e, PL_utf8_perl_idcont);
|
||||
return IS_UTF8_IN_INVLIST(p, e, PL_utf8_perl_idcont);
|
||||
}
|
||||
|
||||
STATIC UV
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user