Skip to content

Commit a015052

Browse files
committed
Convert all core uvchr_to_utf8 calls to uv_to_utf8
This uses the new more modern synonym. In a few cases, it was calling the flags version with no flags, so I changed to use the no flags version
1 parent fcc9d7e commit a015052

File tree

10 files changed

+29
-30
lines changed

10 files changed

+29
-30
lines changed

doop.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ S_do_trans_simple(pTHX_ SV * const sv, const OPtrans_map * const tbl)
8585
const UV c = utf8n_to_uvchr(s, send - s, &ulen, UTF8_ALLOW_DEFAULT);
8686
if (c < 0x100 && (ch = tbl->map[c]) >= 0) {
8787
matches++;
88-
d = uvchr_to_utf8(d, (UV)ch);
88+
d = uv_to_utf8(d, (UV)ch);
8989
s += ulen;
9090
}
9191
else { /* No match -> copy */
@@ -282,7 +282,7 @@ S_do_trans_complex(pTHX_ SV * const sv, const OPtrans_map * const tbl)
282282
replace:
283283
matches++;
284284
if (LIKELY(!squash || ch != pch)) {
285-
d = uvchr_to_utf8(d, ch);
285+
d = uv_to_utf8(d, ch);
286286
pch = ch;
287287
}
288288
s += len;
@@ -541,7 +541,7 @@ S_do_trans_invmap(pTHX_ SV * const sv, AV * const invmap)
541541
* to the output */
542542
if (! squash || to != previous_map) {
543543
if (out_is_utf8) {
544-
d = uvchr_to_utf8(d, to);
544+
d = uv_to_utf8(d, to);
545545
}
546546
else {
547547
if (to >= 256) { /* If need to convert to UTF-8, restart */

op.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6574,12 +6574,12 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
65746574
start = MIN(IV_MAX, start);
65756575
end = MIN(IV_MAX, end);
65766576

6577-
temp_end_pos = uvchr_to_utf8(temp, start);
6577+
temp_end_pos = uv_to_utf8(temp, start);
65786578
sv_catpvn(inverted_tstr, (char *) temp, temp_end_pos - temp);
65796579

65806580
if (start != end) {
65816581
Perl_sv_catpvf(aTHX_ inverted_tstr, "%c", RANGE_INDICATOR);
6582-
temp_end_pos = uvchr_to_utf8(temp, end);
6582+
temp_end_pos = uv_to_utf8(temp, end);
65836583
sv_catpvn(inverted_tstr, (char *) temp, temp_end_pos - temp);
65846584
}
65856585
}

perl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ perl_construct(pTHXx)
311311
STATUS_ALL_SUCCESS;
312312

313313
init_uniprops();
314-
(void) uvchr_to_utf8_flags((U8 *) PL_TR_SPECIAL_HANDLING_UTF8,
315-
TR_SPECIAL_HANDLING,
316-
UNICODE_ALLOW_ABOVE_IV_MAX);
314+
(void) uv_to_utf8_flags((U8 *) PL_TR_SPECIAL_HANDLING_UTF8,
315+
TR_SPECIAL_HANDLING,
316+
UNICODE_ALLOW_ABOVE_IV_MAX);
317317

318318
#if defined(LOCAL_PATCH_COUNT)
319319
PL_localpatches = local_patches; /* For possible -v */

pp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ PP(pp_chr)
39903990

39913991
if (value > 255 && !IN_BYTES) {
39923992
SvGROW(TARG, (STRLEN)UVCHR_SKIP(value)+1);
3993-
tmps = (char*)uvchr_to_utf8_flags((U8*)SvPVX(TARG), value, 0);
3993+
tmps = (char*)uv_to_utf8((U8*)SvPVX(TARG), value);
39943994
SvCUR_set(TARG, tmps - SvPVX_const(TARG));
39953995
*tmps = '\0';
39963996
(void)SvPOK_only(TARG);

pp_pack.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ marked_upgrade(pTHX_ SV *sv, tempsym_t *sym_ptr) {
20202020

20212021
for (;from_ptr < from_end; from_ptr++) {
20222022
while (*m == from_ptr) *m++ = to_ptr;
2023-
to_ptr = (char *) uvchr_to_utf8((U8 *) to_ptr, *(U8 *) from_ptr);
2023+
to_ptr = (char *) uv_to_utf8((U8 *) to_ptr, *(U8 *) from_ptr);
20242024
}
20252025
*to_ptr = 0;
20262026

@@ -2391,7 +2391,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
23912391
GROWING(0, cat, start, cur, fromlen*(UTF8_EXPAND-1)+len);
23922392
len -= fromlen;
23932393
while (fromlen > 0) {
2394-
cur = (char *) uvchr_to_utf8((U8 *) cur, * (U8 *) aptr);
2394+
cur = (char *) uv_to_utf8((U8 *) cur, * (U8 *) aptr);
23952395
aptr++;
23962396
fromlen--;
23972397
}
@@ -2605,7 +2605,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
26052605
GROWING(0, cat, start, cur, len+UTF8_MAXLEN);
26062606
end = start+SvLEN(cat)-UTF8_MAXLEN;
26072607
}
2608-
cur = (char *) uvchr_to_utf8_flags((U8 *) cur, auv, 0);
2608+
cur = (char *) uv_to_utf8((U8 *) cur, auv);
26092609
} else {
26102610
if (auv >= 0x100) {
26112611
if (!SvUTF8(cat)) {
@@ -2656,7 +2656,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
26562656
auv = SvUV_no_inf(fromstr, datumtype);
26572657
if (utf8) {
26582658
U8 buffer[UTF8_MAXLEN+1], *endb;
2659-
endb = uvchr_to_utf8_flags(buffer, auv, 0);
2659+
endb = uv_to_utf8(buffer, auv);
26602660
if (cur+(endb-buffer)*UTF8_EXPAND >= end) {
26612661
*cur = '\0';
26622662
SvCUR_set(cat, cur - start);
@@ -2672,7 +2672,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
26722672
GROWING(0, cat, start, cur, len+UTF8_MAXLEN);
26732673
end = start+SvLEN(cat)-UTF8_MAXLEN;
26742674
}
2675-
cur = (char *) uvchr_to_utf8_flags((U8 *) cur, auv, 0);
2675+
cur = (char *) uv_to_utf8((U8 *) cur, auv);
26762676
}
26772677
}
26782678
break;

regcomp.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6725,7 +6725,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
67256725
*(s++) = (char) ender;
67266726
}
67276727
else {
6728-
U8 * new_s = uvchr_to_utf8((U8*)s, ender);
6728+
U8 * new_s = uv_to_utf8((U8*)s, ender);
67296729
added_len = (char *) new_s - s;
67306730
s = (char *) new_s;
67316731

@@ -11805,7 +11805,7 @@ S_optimize_regclass(pTHX_
1180511805
*STRINGs(REGNODE_p(*ret)) = (U8) value;
1180611806
}
1180711807
else {
11808-
uvchr_to_utf8((U8 *) STRINGs(REGNODE_p(*ret)), value);
11808+
uv_to_utf8((U8 *) STRINGs(REGNODE_p(*ret)), value);
1180911809
}
1181011810

1181111811
return op;
@@ -12088,8 +12088,8 @@ S_optimize_regclass(pTHX_
1208812088

1208912089
/* Place the lowest UTF-8 start byte in the flags field, so as to allow
1209012090
* efficient ruling out at run time of many possible inputs. */
12091-
(void) uvchr_to_utf8(low_utf8, start[0]);
12092-
(void) uvchr_to_utf8(high_utf8, end[0]);
12091+
(void) uv_to_utf8(low_utf8, start[0]);
12092+
(void) uv_to_utf8(high_utf8, end[0]);
1209312093

1209412094
/* If all code points share the same first byte, this can be an
1209512095
* ANYOFRb. Otherwise store the lowest UTF-8 start byte which can
@@ -12123,7 +12123,7 @@ S_optimize_regclass(pTHX_
1212312123
* regnode can be used for higher ones, but we can't calculate the code
1212412124
* point of those. IV_MAX suffices though, as it will be a large first
1212512125
* byte */
12126-
Size_t low_len = uvchr_to_utf8(low_utf8, MIN(lowest_cp, IV_MAX))
12126+
Size_t low_len = uv_to_utf8(low_utf8, MIN(lowest_cp, IV_MAX))
1212712127
- low_utf8;
1212812128

1212912129
/* We store the lowest possible first byte of the UTF-8 representation,
@@ -12140,7 +12140,7 @@ S_optimize_regclass(pTHX_
1214012140
* well */
1214112141
if (highest_cp <= IV_MAX) {
1214212142
U8 high_utf8[UTF8_MAXBYTES+1];
12143-
Size_t high_len = uvchr_to_utf8(high_utf8, highest_cp) - high_utf8;
12143+
Size_t high_len = uv_to_utf8(high_utf8, highest_cp) - high_utf8;
1214412144

1214512145
/* If the lowest and highest are the same, we can get an exact
1214612146
* first byte instead of a just minimum or even a sequence of exact
@@ -14064,8 +14064,7 @@ S_get_extended_utf8_msg(pTHX_ const UV cp)
1406414064
HV *msgs;
1406514065
SV **msg;
1406614066

14067-
uvchr_to_utf8_flags_msgs(dummy, cp, UNICODE_WARN_PERL_EXTENDED,
14068-
&msgs);
14067+
uv_to_utf8_msgs(dummy, cp, UNICODE_WARN_PERL_EXTENDED, &msgs);
1406914068

1407014069
msg = hv_fetchs(msgs, "text", 0);
1407114070
assert(msg);

regcomp_trie.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ and would end up looking like:
381381
8: EXACT <baz>(10)
382382
10: END(0)
383383
384-
d = uvchr_to_utf8_flags(d, uv, 0);
384+
d = uv_to_utf8(d, uv);
385385
386386
is the recommended Unicode-aware way of saying
387387
@@ -393,7 +393,7 @@ is the recommended Unicode-aware way of saying
393393
if (UTF) { \
394394
SV *zlopp = newSV(UTF8_MAXBYTES); \
395395
unsigned char *flrbbbbb = (unsigned char *) SvPVX(zlopp); \
396-
unsigned char *const kapow = uvchr_to_utf8(flrbbbbb, val); \
396+
unsigned char *const kapow = uv_to_utf8(flrbbbbb, val); \
397397
*kapow = '\0'; \
398398
SvCUR_set(zlopp, kapow - flrbbbbb); \
399399
SvPOK_on(zlopp); \

regexec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5015,7 +5015,7 @@ S_setup_EXACTISH_ST(pTHX_ const regnode * const text_node,
50155015

50165016
/* Add this character to the list of possible matches */
50175017
if (utf8_target) {
5018-
uvchr_to_utf8(matches[(U8) m->count], fold_from);
5018+
uv_to_utf8(matches[(U8) m->count], fold_from);
50195019
lengths[m->count] = UVCHR_SKIP(fold_from);
50205020
m->count++;
50215021
}

sv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13251,7 +13251,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
1325113251
{
1325213252
STATIC_ASSERT_STMT(sizeof(ebuf) >= UTF8_MAXBYTES + 1);
1325313253
eptr = ebuf;
13254-
elen = uvchr_to_utf8((U8*)eptr, uv) - (U8*)ebuf;
13254+
elen = uv_to_utf8((U8*)eptr, uv) - (U8*)ebuf;
1325513255
is_utf8 = TRUE;
1325613256
}
1325713257
else {

toke.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ S_missingterm(pTHX_ char *s, STRLEN len)
775775
len = 1;
776776
}
777777
else {
778-
char *end = (char *)uvchr_to_utf8((U8 *)tmpbuf, PL_multi_close);
778+
char *end = (char *) uv_to_utf8((U8 *)tmpbuf, PL_multi_close);
779779
*end = '\0';
780780
len = end - tmpbuf;
781781
uni = TRUE;
@@ -3620,7 +3620,7 @@ S_scan_const(pTHX_ char *start)
36203620
if (real_range_max > 0x101) {
36213621
*d++ = (char) RANGE_INDICATOR;
36223622
}
3623-
d = (char*)uvchr_to_utf8((U8*)d, real_range_max);
3623+
d = (char*) uv_to_utf8((U8*)d, real_range_max);
36243624
}
36253625
}
36263626
#endif
@@ -3907,7 +3907,7 @@ S_scan_const(pTHX_ char *start)
39073907
d = SvCUR(sv) + SvGROW(sv, needed);
39083908
}
39093909

3910-
d = (char*) uvchr_to_utf8_flags((U8*)d, uv,
3910+
d = (char*) uv_to_utf8_flags((U8*)d, uv,
39113911
(ckWARN(WARN_PORTABLE))
39123912
? UNICODE_WARN_PERL_EXTENDED
39133913
: 0);
@@ -13294,7 +13294,7 @@ Perl_scan_vstring(pTHX_ const char *s, const char *const e, SV *sv)
1329413294
}
1329513295

1329613296
/* Append native character for the rev point */
13297-
tmpend = uvchr_to_utf8(tmpbuf, rev);
13297+
tmpend = uv_to_utf8(tmpbuf, rev);
1329813298
sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
1329913299
if (!UVCHR_IS_INVARIANT(rev))
1330013300
SvUTF8_on(sv);

0 commit comments

Comments
 (0)