Apd |int |sv_isobject |NULLOK SV* sv
Apd |STRLEN |sv_len |NULLOK SV *const sv
Apd |STRLEN |sv_len_utf8 |NULLOK SV *const sv
+p |STRLEN |sv_len_utf8_nomg|NN SV *const sv
Apd |void |sv_magic |NN SV *const sv|NULLOK SV *const obj|const int how \
|NULLOK const char *const name|const I32 namlen
Apd |MAGIC *|sv_magicext |NN SV *const sv|NULLOK SV *const obj|const int how \
#define sv_clean_objs() Perl_sv_clean_objs(aTHX)
#define sv_del_backref(a,b) Perl_sv_del_backref(aTHX_ a,b)
#define sv_free_arenas() Perl_sv_free_arenas(aTHX)
+#define sv_len_utf8_nomg(a) Perl_sv_len_utf8_nomg(aTHX_ a)
#define sv_ref(a,b,c) Perl_sv_ref(aTHX_ a,b,c)
#define sv_sethek(a,b) Perl_sv_sethek(aTHX_ a,b)
#ifndef PERL_IMPLICIT_CONTEXT
}
tmps = SvPV_const(sv, curlen);
if (DO_UTF8(sv)) {
- utf8_curlen = sv_len_utf8(sv);
+ utf8_curlen = sv_len_utf8_nomg(sv);
if (utf8_curlen == curlen)
utf8_curlen = 0;
else
PERL_CALLCONV STRLEN Perl_sv_len(pTHX_ SV *const sv);
PERL_CALLCONV STRLEN Perl_sv_len_utf8(pTHX_ SV *const sv);
+PERL_CALLCONV STRLEN Perl_sv_len_utf8_nomg(pTHX_ SV *const sv)
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_SV_LEN_UTF8_NOMG \
+ assert(sv)
+
PERL_CALLCONV void Perl_sv_magic(pTHX_ SV *const sv, SV *const obj, const int how, const char *const name, const I32 namlen)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SV_MAGIC \
return mg_length(sv);
else
{
- STRLEN len;
- const U8 *s = (U8*)SvPV_const(sv, len);
+ SvGETMAGIC(sv);
+ return sv_len_utf8_nomg(sv);
+ }
+}
+
+STRLEN
+Perl_sv_len_utf8_nomg(pTHX_ SV * const sv)
+{
+ dVAR;
+ STRLEN len;
+ const U8 *s = (U8*)SvPV_nomg_const(sv, len);
- if (PL_utf8cache) {
+ PERL_ARGS_ASSERT_SV_LEN_UTF8_NOMG;
+
+ if (PL_utf8cache) {
STRLEN ulen;
MAGIC *mg = SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL;
utf8_mg_len_cache_update(sv, &mg, ulen);
}
return ulen;
- }
- return Perl_utf8_length(aTHX_ s, s + len);
}
+ return Perl_utf8_length(aTHX_ s, s + len);
}
/* Walk forwards to find the byte corresponding to the passed in UTF-8
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan (tests => 303);
+ plan (tests => 304);
}
use strict;
; check_count 'select $tied_undef, ...';
}
+$var = "\x{100}";
+$dummy = substr$var,0,1; check_count 'substr $utf8';
+
{
local $SIG{__WARN__} = sub {};
$dummy = warn $var ; check_count 'warn $tied';