diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-12-26 18:53:48 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-12-26 18:53:48 +0000 |
commit | 238b27b30e66cbca6d4615d2e20bf4a279a86f89 (patch) | |
tree | 73ffd5910f4cada2eed16f8386338026a3decc22 | |
parent | 43230e26bd52e1dcdb541bb4a927c941262b74ed (diff) | |
download | perl-238b27b30e66cbca6d4615d2e20bf4a279a86f89.tar.gz |
Tweak Perl_sv_upgrade() so that references can upgrade to SVt_PV
rather than something bigger. Fix a possible bug - "reference" to
SVt_NV needs to go direct to SVt_PVNV.
p4raw-id: //depot/perl@32738
-rw-r--r-- | sv.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1095,6 +1095,9 @@ S_new_body(pTHX_ svtype sv_type) #endif +static const struct body_details fake_rv = + { 0, 0, 0, SVt_IV, FALSE, NONV, NOARENA, 0 }; + /* =for apidoc sv_upgrade @@ -1113,7 +1116,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, svtype new_type) void* new_body; const svtype old_type = SvTYPE(sv); const struct body_details *new_type_details; - const struct body_details *const old_type_details + const struct body_details *old_type_details = bodies_by_type + old_type; SV *referant = NULL; @@ -1170,11 +1173,9 @@ Perl_sv_upgrade(pTHX_ register SV *sv, svtype new_type) case SVt_IV: if (SvROK(sv)) { referant = SvRV(sv); - if (new_type < SVt_PVIV) { - new_type = SVt_PVIV; - /* FIXME to check SvROK(sv) ? SVt_PV : and fake up - old_body_details */ - } + old_type_details = &fake_rv; + if (new_type == SVt_NV) + new_type = SVt_PVNV; } else { if (new_type < SVt_PVIV) { new_type = (new_type == SVt_NV) |