=for apidoc A|UV|utf8n_to_uvuni|const U8 *s|STRLEN curlen|STRLEN *retlen|U32 flags
Bottom level UTF-8 decode routine.
-Returns the unicode code point value of the first character in the string C<s>
+Returns the Unicode code point value of the first character in the string C<s>
which is assumed to be in UTF-8 encoding and no longer than C<curlen>;
C<retlen> will be set to the length, in bytes, of that character.
{
dVAR;
SV* retval;
- SV* const tokenbufsv = sv_newmortal();
dSP;
const size_t pkg_len = strlen(pkg);
const size_t name_len = strlen(name);
PUSHs(sv_2mortal(newSViv(minbits)));
PUSHs(sv_2mortal(newSViv(none)));
PUTBACK;
- if (IN_PERL_COMPILETIME) {
- /* XXX ought to be handled by lex_start */
- SAVEI16(PL_in_my);
- PL_in_my = 0;
- sv_setpv(tokenbufsv, PL_tokenbuf);
- }
errsv_save = newSVsv(ERRSV);
if (call_method("SWASHNEW", G_SCALAR))
retval = newSVsv(*PL_stack_sp--);
LEAVE;
POPSTACK;
if (IN_PERL_COMPILETIME) {
- STRLEN len;
- const char* const pv = SvPV_const(tokenbufsv, len);
-
- Copy(pv, PL_tokenbuf, len+1, char);
CopHINTS_set(PL_curcop, PL_hints);
}
if (!SvROK(retval) || SvTYPE(SvRV(retval)) != SVt_PVHV) {
}
PL_last_swash_hv = hv;
+ assert(klen <= sizeof(PL_last_swash_key));
PL_last_swash_klen = (U8)klen;
/* FIXME change interpvar.h? */
PL_last_swash_tmps = (U8 *) tmps;
}
/* create and initialize $swatch */
- swatch = newSVpvs("");
scur = octets ? (span * octets) : (span + 7) / 8;
- SvGROW(swatch, scur + 1);
+ swatch = newSV(scur);
+ SvPOK_on(swatch);
s = (U8*)SvPVX(swatch);
if (octets && none) {
const U8* const e = s + scur;
const char *s, *e;
sv_setpvn(dsv, "", 0);
+ SvUTF8_off(dsv);
for (s = (const char *)spv, e = s + len; s < e; s += UTF8SKIP(s)) {
UV u;
/* This serves double duty as a flag and a character to print after
default: break;
}
if (ok) {
- Perl_sv_catpvf(aTHX_ dsv, "\\%c", ok);
+ const char string = ok;
+ sv_catpvn(dsv, &string, 1);
}
}
/* isPRINT() is the locale-blind version. */
if (!ok && (flags & UNI_DISPLAY_ISPRINT) && isPRINT(c)) {
- Perl_sv_catpvf(aTHX_ dsv, "%c", c);
+ const char string = c;
+ sv_catpvn(dsv, &string, 1);
ok = 1;
}
}
if (pe1)
e1 = *(U8**)pe1;
+ /* assert(e1 || l1); */
if (e1 == 0 || (l1 && l1 < (UV)(e1 - (const U8*)s1)))
f1 = (const U8*)s1 + l1;
if (pe2)
e2 = *(U8**)pe2;
+ /* assert(e2 || l2); */
if (e2 == 0 || (l2 && l2 < (UV)(e2 - (const U8*)s2)))
f2 = (const U8*)s2 + l2;
+ /* This shouldn't happen. However, putting an assert() there makes some
+ * tests fail. */
+ /* assert((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0)); */
if ((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0))
return 1; /* mismatch; possible infinite loop or false positive */