SV * const sv = data->last_found;
MAGIC * const mg =
SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL;
- if (mg && mg->mg_len > 0)
+ if (mg)
mg->mg_len = 0;
}
data->last_end = -1;
? I32_MAX : data->pos_min + data->pos_delta;
}
sv_catpvn(data->last_found, STRING(scan), STR_LEN(scan));
+ if (UTF)
+ SvUTF8_on(data->last_found);
{
SV * const sv = data->last_found;
MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?
mg->mg_len += utf8_length((U8*)STRING(scan),
(U8*)STRING(scan)+STR_LEN(scan));
}
- if (UTF)
- SvUTF8_on(data->last_found);
data->last_end = data->pos_min + l;
data->pos_min += l; /* As in the first entry. */
data->flags &= ~SF_BEFORE_EOL;
the group. */
scan_commit(pRExC_state,data);
if (mincount && last_str) {
- sv_setsv(data->last_found, last_str);
+ SV *sv = data->last_found;
+ MAGIC *mg = SvUTF8(sv) && SvMAGICAL(sv) ?
+ mg_find(sv, PERL_MAGIC_utf8) : NULL;
+
+ if (mg)
+ mg->mg_len = -1;
+ sv_setsv(sv, last_str);
data->last_end = data->pos_min;
data->last_start_min =
data->pos_min - CHR_SVLEN(last_str);
const U8 *s = (U8*)SvPV_const(sv, len);
MAGIC *mg = SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : 0;
- if (mg && mg->mg_len != -1 && (mg->mg_len > 0 || len == 0)) {
+ if (mg && mg->mg_len != -1) {
ulen = mg->mg_len;
#ifdef PERL_UTF8_CACHE_ASSERT
assert(ulen == Perl_utf8_length(aTHX_ s, s + len));
bool found = FALSE;
if (SvMAGICAL(sv) && !SvREADONLY(sv)) {
- if (!*mgp)
+ if (!*mgp) {
*mgp = sv_magicext(sv, 0, PERL_MAGIC_utf8, (MGVTBL*)&PL_vtbl_utf8, 0, 0);
+ (*mgp)->mg_len = -1;
+ }
assert(*mgp);
if ((*mgp)->mg_ptr)
}
#ifdef PERL_UTF8_CACHE_ASSERT
if (found) {
- U8 *s = start;
+ const U8 *s = start;
I32 n = uoff;
while (n-- && s < send)
if (!mg) {
sv_magic(sv, 0, PERL_MAGIC_utf8, 0, 0);
mg = mg_find(sv, PERL_MAGIC_utf8);
+ mg->mg_len = -1;
}
assert(mg);