diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-09-30 23:54:17 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-10-01 12:51:58 -0700 |
commit | 48a5da33bd0f1ec8d1516f90d3bdf25b24acda6e (patch) | |
tree | dc57d8b9dd51cbc17ee4cbc3e1a49adad7701a22 /pp_pack.c | |
parent | 7a385470b6148c63a6ff94adce7c33b205d922b2 (diff) | |
download | perl-48a5da33bd0f1ec8d1516f90d3bdf25b24acda6e.tar.gz |
pp_pack.c: Simplify sv length determination in one spot
sv_len_utf8 is now careful not to record caches on magical or over-
loaded scalars (any non-PV, in fact). It also returns the number of
logical characters correctly, regardless of whether its input is utf8.
So we can greatly simplify this code.
Diffstat (limited to 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 13 |
1 files changed, 1 insertions, 12 deletions
@@ -2558,18 +2558,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) if (lookahead.howlen == e_number) count = lookahead.length; else { if (items > 0) { - if (SvGAMAGIC(*beglist)) { - /* Avoid reading the active data more than once - by copying it to a temporary. */ - STRLEN len; - const char *const pv = SvPV_const(*beglist, len); - SV *const temp - = newSVpvn_flags(pv, len, - SVs_TEMP | SvUTF8(*beglist)); - *beglist = temp; - } - count = DO_UTF8(*beglist) ? - sv_len_utf8(*beglist) : sv_len(*beglist); + count = sv_len_utf8(*beglist); } else count = 0; if (lookahead.code == 'Z') count++; |