mirror of
https://github.com/Perl/perl5.git
synced 2026-01-27 01:44:43 +00:00
utf8.c: Change name of static function
This function has always confused me, as it doesn't return a swash, but a swatch.
This commit is contained in:
parent
20b1a8918c
commit
b0e3252edb
@ -2149,7 +2149,7 @@ sn |NV|mulexp10 |NV value|I32 exponent
|
||||
sRn |STRLEN |is_utf8_char_slow|NN const U8 *s|const STRLEN len
|
||||
sRM |UV |check_locale_boundary_crossing|NN const U8* const p|const UV result|NN U8* const ustrp|NN STRLEN *lenp
|
||||
sR |bool |is_utf8_common |NN const U8 *const p|NN SV **swash|NN const char * const swashname
|
||||
sR |SV* |swash_get |NN SV* swash|UV start|UV span
|
||||
sR |SV* |swatch_get |NN SV* swash|UV start|UV span
|
||||
#endif
|
||||
|
||||
Apd |void |sv_setsv_flags |NN SV *dstr|NULLOK SV *sstr|const I32 flags
|
||||
|
||||
2
embed.h
2
embed.h
@ -1589,7 +1589,7 @@
|
||||
#define check_locale_boundary_crossing(a,b,c,d) S_check_locale_boundary_crossing(aTHX_ a,b,c,d)
|
||||
#define is_utf8_char_slow S_is_utf8_char_slow
|
||||
#define is_utf8_common(a,b,c) S_is_utf8_common(aTHX_ a,b,c)
|
||||
#define swash_get(a,b,c) S_swash_get(aTHX_ a,b,c)
|
||||
#define swatch_get(a,b,c) S_swatch_get(aTHX_ a,b,c)
|
||||
#define to_lower_latin1(a,b,c) S_to_lower_latin1(aTHX_ a,b,c)
|
||||
# endif
|
||||
# if defined(PERL_IN_UTF8_C) || defined(PERL_IN_PP_C)
|
||||
|
||||
@ -662,6 +662,6 @@ sub _loose_name ($) {
|
||||
}
|
||||
}
|
||||
|
||||
# Now SWASHGET is recasted into a C function S_swash_get (see utf8.c).
|
||||
# Now SWASHGET is recasted into a C function S_swatch_get (see utf8.c).
|
||||
|
||||
1;
|
||||
|
||||
4
proto.h
4
proto.h
@ -7079,10 +7079,10 @@ STATIC bool S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, const char * c
|
||||
#define PERL_ARGS_ASSERT_IS_UTF8_COMMON \
|
||||
assert(p); assert(swash); assert(swashname)
|
||||
|
||||
STATIC SV* S_swash_get(pTHX_ SV* swash, UV start, UV span)
|
||||
STATIC SV* S_swatch_get(pTHX_ SV* swash, UV start, UV span)
|
||||
__attribute__warn_unused_result__
|
||||
__attribute__nonnull__(pTHX_1);
|
||||
#define PERL_ARGS_ASSERT_SWASH_GET \
|
||||
#define PERL_ARGS_ASSERT_SWATCH_GET \
|
||||
assert(swash)
|
||||
|
||||
STATIC U8 S_to_lower_latin1(pTHX_ const U8 c, U8 *p, STRLEN *lenp)
|
||||
|
||||
28
utf8.c
28
utf8.c
@ -2533,7 +2533,7 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits
|
||||
* the lower-level routine, and it is similarly broken for returning
|
||||
* multiple values. --jhi
|
||||
* For those, you should use to_utf8_case() instead */
|
||||
/* Now SWASHGET is recasted into S_swash_get in this file. */
|
||||
/* Now SWASHGET is recasted into S_swatch_get in this file. */
|
||||
|
||||
/* Note:
|
||||
* Returns the value of property/mapping C<swash> for the first character
|
||||
@ -2633,7 +2633,7 @@ Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8)
|
||||
/* Try our second-level swatch cache, kept in a hash. */
|
||||
SV** svp = hv_fetch(hv, (const char*)ptr, klen, FALSE);
|
||||
|
||||
/* If not cached, generate it via swash_get */
|
||||
/* If not cached, generate it via swatch_get */
|
||||
if (!svp || !SvPOK(*svp)
|
||||
|| !(tmps = (const U8*)SvPV_const(*svp, slen))) {
|
||||
/* We use utf8n_to_uvuni() as we want an index into
|
||||
@ -2642,7 +2642,7 @@ Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8)
|
||||
const UV code_point = utf8n_to_uvuni(ptr, UTF8_MAXBYTES, 0,
|
||||
ckWARN(WARN_UTF8) ?
|
||||
0 : UTF8_ALLOW_ANY);
|
||||
swatch = swash_get(swash,
|
||||
swatch = swatch_get(swash,
|
||||
/* On EBCDIC & ~(0xA0-1) isn't a useful thing to do */
|
||||
(klen) ? (code_point & ~((UV)needents - 1)) : 0,
|
||||
needents);
|
||||
@ -2816,7 +2816,7 @@ S_swash_scan_list_line(pTHX_ U8* l, U8* const lend, UV* min, UV* max, UV* val,
|
||||
* Should be used via swash_fetch, which will cache the swatch in C<swash>.
|
||||
*/
|
||||
STATIC SV*
|
||||
S_swash_get(pTHX_ SV* swash, UV start, UV span)
|
||||
S_swatch_get(pTHX_ SV* swash, UV start, UV span)
|
||||
{
|
||||
SV *swatch;
|
||||
U8 *l, *lend, *x, *xend, *s, *send;
|
||||
@ -2837,10 +2837,10 @@ S_swash_get(pTHX_ SV* swash, UV start, UV span)
|
||||
const UV none = SvUV(*nonesvp);
|
||||
UV end = start + span;
|
||||
|
||||
PERL_ARGS_ASSERT_SWASH_GET;
|
||||
PERL_ARGS_ASSERT_SWATCH_GET;
|
||||
|
||||
if (bits != 1 && bits != 8 && bits != 16 && bits != 32) {
|
||||
Perl_croak(aTHX_ "panic: swash_get doesn't expect bits %"UVuf,
|
||||
Perl_croak(aTHX_ "panic: swatch_get doesn't expect bits %"UVuf,
|
||||
(UV)bits);
|
||||
}
|
||||
|
||||
@ -3014,19 +3014,19 @@ S_swash_get(pTHX_ SV* swash, UV start, UV span)
|
||||
otherbitssvp = hv_fetchs(otherhv, "BITS", FALSE);
|
||||
otherbits = (STRLEN)SvUV(*otherbitssvp);
|
||||
if (bits < otherbits)
|
||||
Perl_croak(aTHX_ "panic: swash_get found swatch size mismatch");
|
||||
Perl_croak(aTHX_ "panic: swatch_get found swatch size mismatch");
|
||||
|
||||
/* The "other" swatch must be destroyed after. */
|
||||
other = swash_get(*othersvp, start, span);
|
||||
other = swatch_get(*othersvp, start, span);
|
||||
o = (U8*)SvPV(other, olen);
|
||||
|
||||
if (!olen)
|
||||
Perl_croak(aTHX_ "panic: swash_get got improper swatch");
|
||||
Perl_croak(aTHX_ "panic: swatch_get got improper swatch");
|
||||
|
||||
s = (U8*)SvPV(swatch, slen);
|
||||
if (bits == 1 && otherbits == 1) {
|
||||
if (slen != olen)
|
||||
Perl_croak(aTHX_ "panic: swash_get found swatch length mismatch");
|
||||
Perl_croak(aTHX_ "panic: swatch_get found swatch length mismatch");
|
||||
|
||||
switch (opc) {
|
||||
case '+':
|
||||
@ -3353,13 +3353,13 @@ Perl__swash_inversion_hash(pTHX_ SV* const swash)
|
||||
/*DEBUG_U(PerlIO_printf(Perl_debug_log, "Adding %"UVXf" to list for %"UVXf"\n", inverse, val));*/
|
||||
}
|
||||
|
||||
/* swash_get() increments the value of val for each element in the
|
||||
/* swatch_get() increments the value of val for each element in the
|
||||
* range. That makes more compact tables possible. You can
|
||||
* express the capitalization, for example, of all consecutive
|
||||
* letters with a single line: 0061\t007A\t0041 This maps 0061 to
|
||||
* 0041, 0062 to 0042, etc. I (khw) have never understood 'none',
|
||||
* and it's not documented; it appears to be used only in
|
||||
* implementing tr//; I copied the semantics from swash_get(), just
|
||||
* implementing tr//; I copied the semantics from swatch_get(), just
|
||||
* in case */
|
||||
if (!none || val < none) {
|
||||
++val;
|
||||
@ -3451,7 +3451,7 @@ Perl__swash_to_invlist(pTHX_ SV* const swash)
|
||||
_invlist_invert_prop(invlist);
|
||||
}
|
||||
|
||||
/* This code is copied from swash_get()
|
||||
/* This code is copied from swatch_get()
|
||||
* read $swash->{EXTRAS} */
|
||||
x = (U8*)SvPV(*extssvp, xcur);
|
||||
xend = x + xcur;
|
||||
@ -3503,7 +3503,7 @@ Perl__swash_to_invlist(pTHX_ SV* const swash)
|
||||
/* The "other" swatch must be destroyed after. */
|
||||
other = _swash_to_invlist((SV *)*othersvp);
|
||||
|
||||
/* End of code copied from swash_get() */
|
||||
/* End of code copied from swatch_get() */
|
||||
switch (opc) {
|
||||
case '+':
|
||||
_invlist_union(invlist, other, &invlist);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user