diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-09 10:46:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-09 10:46:23 +0000 |
commit | c517dc2b8939cf1b60644570194e6918e1629206 (patch) | |
tree | 638c824bec508ccf363666cd7572ad93f47003e7 /util.c | |
parent | 6e6a1aefada3f56f44128d62c37dcbbe95fd2795 (diff) | |
download | perl-c517dc2b8939cf1b60644570194e6918e1629206.tar.gz |
From Inaba Hiroto: the UTF-8 length cache wasn't
updated when fbm_compile() appended a "\n".
p4raw-id: //depot/perl@18857
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -357,8 +357,12 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags) I32 rarest = 0; U32 frequency = 256; - if (flags & FBMcf_TAIL) + if (flags & FBMcf_TAIL) { + MAGIC *mg = SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL; sv_catpvn(sv, "\n", 1); /* Taken into account in fbm_instr() */ + if (mg && mg->mg_len >= 0) + mg->mg_len++; + } s = (U8*)SvPV_force(sv, len); (void)SvUPGRADE(sv, SVt_PVBM); if (len == 0) /* TAIL might be on a zero-length string. */ |