diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-07-12 11:56:59 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-07-12 13:43:19 +0100 |
commit | 0d7caf4cc74eb29a95f71af5a91fef30ca848e41 (patch) | |
tree | 7f573fd94084d95d1ce1616c09d0ec7c282affc3 /sv.c | |
parent | 79d2d448469df7917fb728ca8a674f771610599c (diff) | |
download | perl-0d7caf4cc74eb29a95f71af5a91fef30ca848e41.tar.gz |
Perl_sv_pos_b2u now calls utf8_mg_len_cache_update for the string end offset.
Previously it would not take special action if the offset requested happened to
be the end of the string, meaning that the (fixed size) UTF-8 offset cache
would be used for a value which could (and should) be stored elsewhere.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -6676,8 +6676,12 @@ Perl_sv_pos_b2u(pTHX_ register SV *const sv, I32 *const offsetp) } *offsetp = len; - if (PL_utf8cache) - utf8_mg_pos_cache_update(sv, &mg, byte, len, blen); + if (PL_utf8cache) { + if (blen == byte) + utf8_mg_len_cache_update(sv, &mg, len); + else + utf8_mg_pos_cache_update(sv, &mg, byte, len, blen); + } } /* |