diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-08-08 10:20:40 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-08-08 14:14:42 +0100 |
commit | 1776cbe8523bf67a0626da7b721abaf9f0f8870a (patch) | |
tree | 399d0911956e707a0fe23a08e9ce936a08106091 /sv.c | |
parent | 4d0a25002d260ca3ae716f2f0be258eb5d040c74 (diff) | |
download | perl-1776cbe8523bf67a0626da7b721abaf9f0f8870a.tar.gz |
Move the "types are equal" early return ahead of the COW-removal.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1185,13 +1185,22 @@ Perl_sv_upgrade(pTHX_ register SV *const sv, svtype new_type) PERL_ARGS_ASSERT_SV_UPGRADE; + if (old_type == new_type) + return; + + /* This clause was purposefully added ahead of the early return above to + the shared string hackery for (sort {$a <=> $b} keys %hash), with the + inference by Nick I-S that it would fix other troublesome cases. See + changes 7162, 7163 (f130fd4589cf5fbb24149cd4db4137c8326f49c1 and parent) + + Given that shared hash key scalars are no longer PVIV, but PV, there is + no longer need to unshare so as to free up the IVX slot for its proper + purpose. So it's safe to move the early return earlier. */ + if (new_type != SVt_PV && SvIsCOW(sv)) { sv_force_normal_flags(sv, 0); } - if (old_type == new_type) - return; - old_body = SvANY(sv); /* Copying structures onto other structures that have been neatly zeroed |