Skip to content

Commit 815d0d1

Browse files
committed
Convert last vestiges of to/from 'uvchr' to 'uv'
We are trying to encourage new code to use the latter form, so use it in the remaining pod examples that still used 'uvchr' This also corrects the common entry for uv_to_utf8_msgs() and uvchr_to_utf8_flags_msgs() to be cognizant that there are two identical functions.
1 parent 23ae7f9 commit 815d0d1

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

pod/perlguts.pod

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3568,15 +3568,18 @@ whether the byte is encoded as a single byte even in UTF-8):
35683568
char */
35693569
STRLEN len; /* Returned length of character in bytes */
35703570

3571-
if (!UTF8_IS_INVARIANT(*utf))
3571+
if (!UTF8_IS_INVARIANT(*utf)) {
35723572
/* Must treat this as UTF-8 */
3573-
uv = utf8_to_uvchr_buf(utf, utf_end, &len);
3573+
if (! utf8_to_uv(utf, utf_end, &uv, &len)) {
3574+
/* handle error */
3575+
}
3576+
}
35743577
else
35753578
/* OK to treat this character as a byte */
35763579
uv = *utf;
35773580

3578-
You can also see in that example that we use C<utf8_to_uvchr_buf> to get the
3579-
value of the character; the inverse function C<uvchr_to_utf8> is available
3581+
You can also see in that example that we use C<utf8_to_uv> to get the
3582+
value of the character; the inverse function C<uv_to_utf8> is available
35803583
for putting a UV into UTF-8:
35813584

35823585
if (!UVCHR_IS_INVARIANT(uv))
@@ -3794,7 +3797,7 @@ the PV to somewhere, pass on the flag too.
37943797

37953798
=item *
37963799

3797-
If a string is UTF-8, B<always> use C<utf8_to_uvchr_buf> to get at the value,
3800+
If a string is UTF-8, B<always> use C<utf8_to_uv> to get at the value,
37983801
unless C<UTF8_IS_INVARIANT(*s)> in which case you can use C<*s>.
37993802

38003803
=item *

utf8.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,19 @@ const char super_cp_format[] = "Code point 0x%" UVXf " is not Unicode,"
123123
=for apidoc_item uvchr_to_utf8_flags_msgs
124124
125125
These functions are identical. THEY SHOULD BE USED IN ONLY VERY SPECIALIZED
126-
CIRCUMSTANCES.
126+
CIRCUMSTANCES. The C<uv_to_utf8_msgs> spelling is preferred in new code.
127127
128-
Most code should use C<L</uv_to_utf8_flags>()> rather than call this directly.
128+
Most code should use C<L</uv_to_utf8_flags>()> rather than call these directly.
129129
130-
This function is for code that wants any warning and/or error messages to be
130+
These functions are for code that wants any warning and/or error messages to be
131131
returned to the caller rather than be displayed. Any message that would have
132132
been displayed if all lexical warnings are enabled will instead be returned.
133133
134-
It is just like C<L</uvchr_to_utf8_flags>> but it takes an extra parameter
135-
placed after all the others, C<msgs>. If this parameter is 0, this function
136-
behaves identically to C<L</uvchr_to_utf8_flags>>. Otherwise, C<msgs> should
137-
be a pointer to an C<HV *> variable, in which this function creates a new HV to
138-
contain any appropriate message. The hash has three key-value pairs, as
134+
They are just like C<L</uv_to_utf8_flags>> but take an extra parameter
135+
placed after all the others, C<msgs>. If this parameter is 0, the functions
136+
behave identically to C<L</uv_to_utf8_flags>>. Otherwise, C<msgs> should
137+
be a pointer to an C<HV *> variable, in which these functions create a new HV
138+
to contain any appropriate message. The hash has three key-value pairs, as
139139
follows:
140140
141141
=over 4
@@ -169,7 +169,7 @@ The possibilities are:
169169
=back
170170
171171
It's important to note that specifying this parameter as non-null will cause
172-
any warning this function would otherwise generate to be suppressed, and
172+
any warning the functions would otherwise generate to be suppressed, and
173173
instead be placed in C<*msgs>. The caller can check the lexical warnings state
174174
(or not) when choosing what to do with the returned message.
175175

0 commit comments

Comments
 (0)