diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-01-21 11:44:16 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-01-21 11:44:16 +0000 |
commit | dc3c76f8b4fe904265e159454587697a06e6e98a (patch) | |
tree | 9432c77912a41c7b379b10b2564c0ddaa9b05b86 /pp_hot.c | |
parent | d9f30342f9de4793189d81b85a5e32057393e428 (diff) | |
download | perl-dc3c76f8b4fe904265e159454587697a06e6e98a.tar.gz |
Refactor the common soft-reference code from pp_rv2sv and pp_rv2av
into a single routine Perl_softref2xv(). As soft references are
rarely used compared with true references, move this code from pp_hot.c
p4raw-id: //depot/perl@29905
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 36 |
1 files changed, 4 insertions, 32 deletions
@@ -836,38 +836,10 @@ PP(pp_rv2av) if (SvROK(sv)) goto wasref; } - if (PL_op->op_private & HINT_STRICT_REFS) { - if (SvOK(sv)) - DIE(aTHX_ PL_no_symref_sv, sv, - is_pp_rv2av ? an_array : a_hash); - else - DIE(aTHX_ PL_no_usym, is_pp_rv2av ? an_array : a_hash); - } - if (!SvOK(sv)) { - if (PL_op->op_flags & OPf_REF) - DIE(aTHX_ PL_no_usym, is_pp_rv2av ? an_array : a_hash); - if (ckWARN(WARN_UNINITIALIZED)) - report_uninit(sv); - if (gimme == G_ARRAY) { - SP--; - RETURN; - } - RETSETUNDEF; - } - if ((PL_op->op_flags & OPf_SPECIAL) && - !(PL_op->op_flags & OPf_MOD)) - { - gv = (GV*)gv_fetchsv(sv, 0, type); - if (!gv - && (!is_gv_magical_sv(sv,0) - || !(gv = (GV*)gv_fetchsv(sv, GV_ADD, type)))) - { - RETSETUNDEF; - } - } - else { - gv = (GV*)gv_fetchsv(sv, GV_ADD, type); - } + gv = Perl_softref2xv(aTHX_ sv, is_pp_rv2av ? an_array : a_hash, + type, &sp); + if (!gv) + RETURN; } else { gv = (GV*)sv; |