Skip to content

Commit 6a491f8

Browse files
committed
Use valid_utf8_to_uv() consistently in core
This is the new preferred synonym.
1 parent 935fddc commit 6a491f8

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

ext/XS-APItest/APItest.xs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ test_valid_utf8_to_uvchr(s)
17881788
*/
17891789
RETVAL = newAV_mortal();
17901790

1791-
ret = valid_utf8_to_uvchr((U8*) SvPV_nolen(s), &retlen);
1791+
ret = valid_utf8_to_uv((U8*) SvPV_nolen(s), &retlen);
17921792

17931793
/* Returns the return value in [0]; <retlen> in [1] */
17941794
av_push_simple(RETVAL, newSVuv(ret));

ext/XS-APItest/t/utf8.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,12 +883,12 @@ for my $u (sort { utf8::unicode_to_native($a) <=> utf8::unicode_to_native($b) }
883883

884884
$ret_ref = test_valid_utf8_to_uvchr($bytes);
885885
is($ret_ref->[0], $n,
886-
"Verify valid_utf8_to_uvchr($display_bytes) returns $hex_n");
886+
"Verify valid_utf8_to_uv($display_bytes) returns $hex_n");
887887
is($ret_ref->[1], $len,
888-
"Verify valid_utf8_to_uvchr() for $hex_n returns expected length: $len");
888+
"Verify valid_utf8_to_uv() for $hex_n returns expected length: $len");
889889

890890
is(scalar @warnings, 0,
891-
"Verify valid_utf8_to_uvchr() for $hex_n generated no warnings")
891+
"Verify valid_utf8_to_uv() for $hex_n generated no warnings")
892892
or output_warnings(@warnings);
893893

894894
# Similarly for uvchr_to_utf8

mathoms.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen)
139139
PERL_UNUSED_CONTEXT;
140140
PERL_ARGS_ASSERT_UTF8_TO_UVUNI;
141141

142-
return NATIVE_TO_UNI(valid_utf8_to_uvchr(s, retlen));
142+
return NATIVE_TO_UNI(valid_utf8_to_uv(s, retlen));
143143
}
144144

145145
U8 *

op.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6585,7 +6585,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
65856585
Size_t t_char_len;
65866586

65876587
/* Get the first character */
6588-
t_cp = valid_utf8_to_uvchr(t, &t_char_len);
6588+
t_cp = valid_utf8_to_uv(t, &t_char_len);
65896589
t += t_char_len;
65906590

65916591
/* If the next byte indicates that this wasn't the first
@@ -6596,7 +6596,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
65966596
else { /* Otherwise, ignore the indicator byte, and get the
65976597
final element, and add the whole range */
65986598
t++;
6599-
t_cp_end = valid_utf8_to_uvchr(t, &t_char_len);
6599+
t_cp_end = valid_utf8_to_uv(t, &t_char_len);
66006600
t += t_char_len;
66016601

66026602
inverted_tlist = _add_range_to_invlist(inverted_tlist,
@@ -6781,7 +6781,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
67816781
* next code point is the next UTF-8 char in the input. We
67826782
* know the input is valid, because the toker constructed
67836783
* it */
6784-
t_cp = CP_ADJUST(valid_utf8_to_uvchr(t, &t_char_len));
6784+
t_cp = CP_ADJUST(valid_utf8_to_uv(t, &t_char_len));
67856785
t += t_char_len;
67866786

67876787
/* UTF-8 strings (only) have been parsed in toke.c to have
@@ -6793,7 +6793,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
67936793
&& ! FORCE_RANGE_LEN_1(t_cp))
67946794
{
67956795
t++;
6796-
t_range_count = valid_utf8_to_uvchr(t, &t_char_len)
6796+
t_range_count = valid_utf8_to_uv(t, &t_char_len)
67976797
- t_cp + 1;
67986798
t += t_char_len;
67996799
}
@@ -6836,13 +6836,13 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
68366836
else {
68376837
Size_t r_char_len;
68386838

6839-
r_cp = CP_ADJUST(valid_utf8_to_uvchr(r, &r_char_len));
6839+
r_cp = CP_ADJUST(valid_utf8_to_uv(r, &r_char_len));
68406840
r += r_char_len;
68416841
if ( r < rend && *r == RANGE_INDICATOR
68426842
&& ! FORCE_RANGE_LEN_1(r_cp))
68436843
{
68446844
r++;
6845-
r_range_count = valid_utf8_to_uvchr(r,
6845+
r_range_count = valid_utf8_to_uv(r,
68466846
&r_char_len) - r_cp + 1;
68476847
r += r_char_len;
68486848
}

regcomp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5294,7 +5294,7 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
52945294

52955295
/* Convert from string to numeric code point */
52965296
*code_point_p = (SvUTF8(value_sv))
5297-
? valid_utf8_to_uvchr(value, NULL)
5297+
? valid_utf8_to_uv(value, NULL)
52985298
: *value;
52995299

53005300
/* Have parsed this entire single code point \N{...}. *cp_count
@@ -15045,7 +15045,7 @@ S_parse_uniprop_string(pTHX_
1504515045
goto failed;
1504615046
}
1504715047

15048-
cp = valid_utf8_to_uvchr((U8 *) SvPVX(character), &character_len);
15048+
cp = valid_utf8_to_uv((U8 *) SvPVX(character), &character_len);
1504915049
if (character_len == SvCUR(character)) {
1505015050
prop_definition = add_cp_to_invlist(NULL, cp);
1505115051
}
@@ -15068,7 +15068,7 @@ S_parse_uniprop_string(pTHX_
1506815068
av_push_simple(this_string, newSVuv(cp));
1506915069

1507015070
do {
15071-
cp = valid_utf8_to_uvchr((U8 *) remaining, &character_len);
15071+
cp = valid_utf8_to_uv((U8 *) remaining, &character_len);
1507215072
av_push_simple(this_string, newSVuv(cp));
1507315073
remaining += character_len;
1507415074
} while (remaining < SvEND(character));

regcomp_trie.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ is the recommended Unicode-aware way of saying
414414
if ( UTF ) { \
415415
/* if it is UTF then it is either already folded, or does not need \
416416
* folding */ \
417-
uvc = valid_utf8_to_uvchr( (const U8*) uc, &len); \
417+
uvc = valid_utf8_to_uv( (const U8*) uc, &len); \
418418
} \
419419
else if (folder == PL_fold_latin1) { \
420420
/* This folder implies Unicode rules, which in the range expressible \

regexec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4939,7 +4939,7 @@ S_setup_EXACTISH_ST(pTHX_ const regnode * const text_node,
49394939
* case. We set 'multi_fold_from' to the single folded-from character,
49404940
* which is handled in an extra iteration below */
49414941
if (utf8_pat) {
4942-
folded = valid_utf8_to_uvchr(pat, NULL);
4942+
folded = valid_utf8_to_uv(pat, NULL);
49434943
multi_fold_from
49444944
= what_MULTI_CHAR_FOLD_utf8_safe(pat, pat + pat_len);
49454945
}
@@ -11836,7 +11836,7 @@ Perl_isSCRIPT_RUN(pTHX_ const U8 * s, const U8 * send, const bool utf8_target)
1183611836
/* Here, isn't an ASCII digit. Find the code point of the character */
1183711837
if (! UTF8_IS_INVARIANT(*s)) {
1183811838
Size_t len;
11839-
cp = valid_utf8_to_uvchr((U8 *) s, &len);
11839+
cp = valid_utf8_to_uv((U8 *) s, &len);
1184011840
s += len;
1184111841
}
1184211842
else {

toke.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,8 +3325,8 @@ S_scan_const(pTHX_ char *start)
33253325
/* We know the utf8 is valid, because we just constructed
33263326
* it ourselves in previous loop iterations */
33273327
min_ptr = (char*) utf8_hop( (U8*) max_ptr, -1);
3328-
range_min = valid_utf8_to_uvchr( (U8*) min_ptr, NULL);
3329-
range_max = valid_utf8_to_uvchr( (U8*) max_ptr, NULL);
3328+
range_min = valid_utf8_to_uv( (U8*) min_ptr, NULL);
3329+
range_max = valid_utf8_to_uv( (U8*) max_ptr, NULL);
33303330

33313331
/* This compensates for not all code setting
33323332
* 'has_above_latin1', so that we don't skip stuff that
@@ -11712,7 +11712,7 @@ Perl_scan_str(pTHX_ char *start, int keep_bracketed_quoted, int keep_delims, int
1171211712
}
1171311713

1171411714
close_delim_code = (UTF)
11715-
? valid_utf8_to_uvchr((U8 *) close_delim_str, NULL)
11715+
? valid_utf8_to_uv((U8 *) close_delim_str, NULL)
1171611716
: * (U8 *) close_delim_str;
1171711717
}
1171811718
else { /* Here, the delimiter isn't paired, hence the close is the same as

utf8.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4198,7 +4198,7 @@ S_check_locale_boundary_crossing(pTHX_ const U8* const p, const UV result,
41984198
bad_crossing:
41994199

42004200
/* Failed, have to return the original */
4201-
original = valid_utf8_to_uvchr(p, lenp);
4201+
original = valid_utf8_to_uv(p, lenp);
42024202

42034203
/* diag_listed_as: Can't do %s("%s") on non-UTF-8 locale; resolved to "%s". */
42044204
ck_warner(packWARN(WARN_LOCALE),
@@ -4575,7 +4575,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p,
45754575
while (s < send) {
45764576
if (isASCII(*s)) {
45774577
/* Crossed, have to return the original */
4578-
original = valid_utf8_to_uvchr(p, lenp);
4578+
original = valid_utf8_to_uv(p, lenp);
45794579

45804580
/* But in these instances, there is an alternative we can
45814581
* return that is valid */

0 commit comments

Comments
 (0)