mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
Change to use UVCHR_SKIP over UNI_SKIP
UNI_SKIP is somewhat ambiguous. Perl has long used 'uvchr' as part of a name to mean the unsigned values using the native character set plus Unicode values for those above 255. This also changes two calls (one in dquote_static.c and one in dquote_inline.h) to use UVCHR_SKIP; they should not have been OFFUNI, as they are dealing with native values.
This commit is contained in:
parent
19d0ef390c
commit
5f560d8a4c
2
dquote.c
2
dquote.c
@ -160,7 +160,7 @@ Perl_grok_bslash_o(pTHX_ char **s, UV *uv, const char** error_msg,
|
||||
|
||||
/* guarantee replacing "\o{...}" with utf8 bytes fits within
|
||||
* existing space */
|
||||
assert(OFFUNISKIP(*uv) < *s - start);
|
||||
assert(UVCHR_SKIP(*uv) < *s - start);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ S_grok_bslash_x(pTHX_ char **s, UV *uv, const char** error_msg,
|
||||
ok:
|
||||
/* guarantee replacing "\x{...}" with utf8 bytes fits within
|
||||
* existing space */
|
||||
assert(OFFUNISKIP(*uv) < *s - start);
|
||||
assert(UVCHR_SKIP(*uv) < *s - start);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
2
op.c
2
op.c
@ -5193,7 +5193,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
|
||||
max = rfirst + diff;
|
||||
if (!grows)
|
||||
grows = (tfirst < rfirst &&
|
||||
UNISKIP(tfirst) < UNISKIP(rfirst + diff));
|
||||
UVCHR_SKIP(tfirst) < UVCHR_SKIP(rfirst + diff));
|
||||
rfirst += diff + 1;
|
||||
}
|
||||
tfirst += diff + 1;
|
||||
|
||||
4
perl.c
4
perl.c
@ -3135,10 +3135,10 @@ Perl_moreswitches(pTHX_ const char *s)
|
||||
s--;
|
||||
}
|
||||
PL_rs = newSVpvs("");
|
||||
SvGROW(PL_rs, (STRLEN)(UNISKIP(rschar) + 1));
|
||||
SvGROW(PL_rs, (STRLEN)(UVCHR_SKIP(rschar) + 1));
|
||||
tmps = (U8*)SvPVX(PL_rs);
|
||||
uvchr_to_utf8(tmps, rschar);
|
||||
SvCUR_set(PL_rs, UNISKIP(rschar));
|
||||
SvCUR_set(PL_rs, UVCHR_SKIP(rschar));
|
||||
SvUTF8_on(PL_rs);
|
||||
}
|
||||
else {
|
||||
|
||||
4
pp.c
4
pp.c
@ -2464,7 +2464,7 @@ S_scomplement(pTHX_ SV *targ, SV *sv)
|
||||
while (tmps < send) {
|
||||
const UV c = utf8n_to_uvchr(tmps, send-tmps, &l, utf8flags);
|
||||
tmps += l;
|
||||
targlen += UNISKIP(~c);
|
||||
targlen += UVCHR_SKIP(~c);
|
||||
nchar++;
|
||||
if (c > 0xff)
|
||||
nwide++;
|
||||
@ -3578,7 +3578,7 @@ PP(pp_chr)
|
||||
SvUPGRADE(TARG,SVt_PV);
|
||||
|
||||
if (value > 255 && !IN_BYTES) {
|
||||
SvGROW(TARG, (STRLEN)UNISKIP(value)+1);
|
||||
SvGROW(TARG, (STRLEN)UVCHR_SKIP(value)+1);
|
||||
tmps = (char*)uvchr_to_utf8_flags((U8*)SvPVX(TARG), value, 0);
|
||||
SvCUR_set(TARG, tmps - SvPVX_const(TARG));
|
||||
*tmps = '\0';
|
||||
|
||||
@ -11579,7 +11579,7 @@ S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state,
|
||||
|
||||
/* A single character node is SIMPLE, except for the special-cased SHARP S
|
||||
* under /di. */
|
||||
if ((len == 1 || (UTF && len == UNISKIP(code_point)))
|
||||
if ((len == 1 || (UTF && len == UVCHR_SKIP(code_point)))
|
||||
#if UNICODE_MAJOR_VERSION > 3 /* no multifolds in early Unicode */ \
|
||||
|| (UNICODE_MAJOR_VERSION == 3 && ( UNICODE_DOT_VERSION > 0) \
|
||||
|| UNICODE_DOT_DOT_VERSION > 0)
|
||||
@ -12635,7 +12635,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
|
||||
* its representation until PASS2. */
|
||||
if (SIZE_ONLY) {
|
||||
if (UTF) {
|
||||
const STRLEN unilen = UNISKIP(ender);
|
||||
const STRLEN unilen = UVCHR_SKIP(ender);
|
||||
s += unilen;
|
||||
|
||||
/* We have to subtract 1 just below (and again in
|
||||
|
||||
@ -1484,7 +1484,7 @@ STMT_START {
|
||||
} else { \
|
||||
uvc = _to_utf8_fold_flags( (const U8*) uc, foldbuf, &foldlen, flags); \
|
||||
len = UTF8SKIP(uc); \
|
||||
skiplen = UNISKIP( uvc ); \
|
||||
skiplen = UVCHR_SKIP( uvc ); \
|
||||
foldlen -= skiplen; \
|
||||
uscan = foldbuf + skiplen; \
|
||||
} \
|
||||
@ -1501,7 +1501,7 @@ STMT_START {
|
||||
} else { \
|
||||
len = 1; \
|
||||
uvc = _to_fold_latin1( (U8) *uc, foldbuf, &foldlen, flags); \
|
||||
skiplen = UNISKIP( uvc ); \
|
||||
skiplen = UVCHR_SKIP( uvc ); \
|
||||
foldlen -= skiplen; \
|
||||
uscan = foldbuf + skiplen; \
|
||||
} \
|
||||
|
||||
14
toke.c
14
toke.c
@ -3227,12 +3227,12 @@ S_scan_const(pTHX_ char *start)
|
||||
*d = '\0';
|
||||
/* See Note on sizing above. */
|
||||
sv_utf8_upgrade_flags_grow(
|
||||
sv,
|
||||
SV_GMAGIC|SV_FORCE_UTF8_UPGRADE
|
||||
sv,
|
||||
SV_GMAGIC|SV_FORCE_UTF8_UPGRADE
|
||||
/* Above-latin1 in string
|
||||
* implies no encoding */
|
||||
|SV_UTF8_NO_ENCODING,
|
||||
UNISKIP(uv) + (STRLEN)(send - s) + 1);
|
||||
UVCHR_SKIP(uv) + (STRLEN)(send - s) + 1);
|
||||
d = SvPVX(sv) + SvCUR(sv);
|
||||
has_utf8 = TRUE;
|
||||
}
|
||||
@ -3362,9 +3362,9 @@ S_scan_const(pTHX_ char *start)
|
||||
*d = '\0';
|
||||
/* See Note on sizing above. */
|
||||
sv_utf8_upgrade_flags_grow(
|
||||
sv,
|
||||
SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
|
||||
UNISKIP(uv) + (STRLEN)(send - e) + 1);
|
||||
sv,
|
||||
SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
|
||||
UVCHR_SKIP(uv) + (STRLEN)(send - e) + 1);
|
||||
d = SvPVX(sv) + SvCUR(sv);
|
||||
has_utf8 = TRUE;
|
||||
}
|
||||
@ -3597,7 +3597,7 @@ S_scan_const(pTHX_ char *start)
|
||||
const UV nextuv = (this_utf8)
|
||||
? utf8n_to_uvchr((U8*)s, send - s, &len, 0)
|
||||
: (UV) ((U8) *s);
|
||||
const STRLEN need = UNISKIP(nextuv);
|
||||
const STRLEN need = UVCHR_SKIP(nextuv);
|
||||
if (!has_utf8) {
|
||||
SvCUR_set(sv, d - SvPVX_const(sv));
|
||||
SvPOK_on(sv);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user