summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-08-26 13:42:53 -0600
committerKarl Williamson <khw@cpan.org>2016-08-31 20:32:35 -0600
commitc5f058dfd0db4297255d7df7a085fdf36232d5b9 (patch)
treec1077dca54f89961a13c2cf40768e53a46de7457 /sv.c
parent8871a094916837597c6a703c2e1b2306314df4fa (diff)
downloadperl-c5f058dfd0db4297255d7df7a085fdf36232d5b9.tar.gz
Use new name 'is_utf8_invariant_string' in core
This changes the places in the core to use the clearer synonym added by the previous commit. It also changes one place that hand-rolled its own code to use this function instead.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sv.c b/sv.c
index c4cac80b15..3e8fb3dbe8 100644
--- a/sv.c
+++ b/sv.c
@@ -3765,7 +3765,6 @@ Perl_sv_utf8_decode(pTHX_ SV *const sv)
if (SvPOKp(sv)) {
const U8 *start, *c;
- const U8 *e;
/* The octets may have got themselves encoded - get them back as
* bytes
@@ -3779,13 +3778,8 @@ Perl_sv_utf8_decode(pTHX_ SV *const sv)
c = start = (const U8 *) SvPVX_const(sv);
if (!is_utf8_string(c, SvCUR(sv)))
return FALSE;
- e = (const U8 *) SvEND(sv);
- while (c < e) {
- const U8 ch = *c++;
- if (!UTF8_IS_INVARIANT(ch)) {
- SvUTF8_on(sv);
- break;
- }
+ if (! is_utf8_invariant_string(c, SvCUR(sv))) {
+ SvUTF8_on(sv);
}
if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) {
/* XXX Is this dead code? XS_utf8_decode calls SvSETMAGIC