Skip to content

Commit 5084a37

Browse files
committed
Use valid_utf8_to_uv() consistently in core
This is the new preferred synonym.
1 parent 8543a7a commit 5084a37

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

ext/XS-APItest/APItest.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55
use Carp;
66

7-
our $VERSION = '1.44';
7+
our $VERSION = '1.45';
88

99
require XSLoader;
1010

ext/XS-APItest/APItest.xs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ test_valid_utf8_to_uvchr(s)
17651765
*/
17661766
RETVAL = newAV_mortal();
17671767

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

17701770
/* Returns the return value in [0]; <retlen> in [1] */
17711771
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
@@ -6555,7 +6555,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
65556555
Size_t t_char_len;
65566556

65576557
/* Get the first character */
6558-
t_cp = valid_utf8_to_uvchr(t, &t_char_len);
6558+
t_cp = valid_utf8_to_uv(t, &t_char_len);
65596559
t += t_char_len;
65606560

65616561
/* If the next byte indicates that this wasn't the first
@@ -6566,7 +6566,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
65666566
else { /* Otherwise, ignore the indicator byte, and get the
65676567
final element, and add the whole range */
65686568
t++;
6569-
t_cp_end = valid_utf8_to_uvchr(t, &t_char_len);
6569+
t_cp_end = valid_utf8_to_uv(t, &t_char_len);
65706570
t += t_char_len;
65716571

65726572
inverted_tlist = _add_range_to_invlist(inverted_tlist,
@@ -6746,7 +6746,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
67466746
* next code point is the next UTF-8 char in the input. We
67476747
* know the input is valid, because the toker constructed
67486748
* it */
6749-
t_cp = CP_ADJUST(valid_utf8_to_uvchr(t, &t_char_len));
6749+
t_cp = CP_ADJUST(valid_utf8_to_uv(t, &t_char_len));
67506750
t += t_char_len;
67516751

67526752
/* UTF-8 strings (only) have been parsed in toke.c to have
@@ -6758,7 +6758,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
67586758
&& ! FORCE_RANGE_LEN_1(t_cp))
67596759
{
67606760
t++;
6761-
t_range_count = valid_utf8_to_uvchr(t, &t_char_len)
6761+
t_range_count = valid_utf8_to_uv(t, &t_char_len)
67626762
- t_cp + 1;
67636763
t += t_char_len;
67646764
}
@@ -6801,13 +6801,13 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
68016801
else {
68026802
Size_t r_char_len;
68036803

6804-
r_cp = CP_ADJUST(valid_utf8_to_uvchr(r, &r_char_len));
6804+
r_cp = CP_ADJUST(valid_utf8_to_uv(r, &r_char_len));
68056805
r += r_char_len;
68066806
if ( r < rend && *r == RANGE_INDICATOR
68076807
&& ! FORCE_RANGE_LEN_1(r_cp))
68086808
{
68096809
r++;
6810-
r_range_count = valid_utf8_to_uvchr(r,
6810+
r_range_count = valid_utf8_to_uv(r,
68116811
&r_char_len) - r_cp + 1;
68126812
r += r_char_len;
68136813
}

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
@@ -11708,7 +11708,7 @@ Perl_scan_str(pTHX_ char *start, int keep_bracketed_quoted, int keep_delims, int
1170811708
}
1170911709

1171011710
close_delim_code = (UTF)
11711-
? valid_utf8_to_uvchr((U8 *) close_delim_str, NULL)
11711+
? valid_utf8_to_uv((U8 *) close_delim_str, NULL)
1171211712
: * (U8 *) close_delim_str;
1171311713
}
1171411714
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)