Skip to content

Commit 5ffd255

Browse files
committed
pv_escape: Use utf8_to_uv, preferred to utf8_to_uvchr_buf
1 parent 00f06a3 commit 5ffd255

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dump.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,15 @@ Perl_pv_escape( pTHX_ SV *dsv, char const * const str,
231231
isuni = 1;
232232

233233
for ( ; pv < end ; pv += readsize ) {
234-
const UV u= (isuni) ? utf8_to_uvchr_buf((U8*)pv, (U8*) end, &readsize) : (U8)*pv;
234+
UV u;
235+
if (isuni) {
236+
/* No need to check for being wellformed, as the is_utf8_string()
237+
* above already did */
238+
(void) utf8_to_uv((U8*)pv, (U8*) end, &u, &readsize);
239+
}
240+
else {
241+
u = (U8)*pv;
242+
}
235243
const U8 c = (U8)u;
236244
const char *source_buf = octbuf;
237245

0 commit comments

Comments
 (0)