summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-07-12 11:56:59 +0100
committerNicholas Clark <nick@ccl4.org>2010-07-12 13:43:19 +0100
commit0d7caf4cc74eb29a95f71af5a91fef30ca848e41 (patch)
tree7f573fd94084d95d1ce1616c09d0ec7c282affc3 /sv.c
parent79d2d448469df7917fb728ca8a674f771610599c (diff)
downloadperl-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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index ce16db6288..3a25abcf10 100644
--- a/sv.c
+++ b/sv.c
@@ -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);
+ }
}
/*