X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=indirect.xs;h=5ec4e03e786b56147f88792b0ce23041d7593c8b;hb=cf93cbf9ffecce3a44dad3b7e89d79bf2933e19e;hp=cd118b1e45dc4b1921ac14057eb403aa731bf89a;hpb=8e33a0159329bb82e048058ea048ab005ea322fe;p=perl%2Fmodules%2Findirect.git diff --git a/indirect.xs b/indirect.xs index cd118b1..5ec4e03 100644 --- a/indirect.xs +++ b/indirect.xs @@ -87,7 +87,6 @@ STATIC const char *indirect_map_fetch(pTHX_ const OP *o, SV ** const name) { STATIC void indirect_map_delete(pTHX_ const OP *o) { #define indirect_map_delete(O) indirect_map_delete(aTHX_ (O)) char buf[32]; - SV *val; hv_delete(indirect_map, buf, OP2STR(o), G_DISCARD); } @@ -147,11 +146,29 @@ STATIC OP *(*indirect_old_ck_rv2sv)(pTHX_ OP *) = 0; STATIC OP *indirect_ck_rv2sv(pTHX_ OP *o) { if (indirect_hint()) { OP *op = cUNOPo->op_first; - SV *name = cSVOPx_sv(op); - if (SvPOK(name) && (SvTYPE(name) >= SVt_PV)) { + const char *name = NULL; + STRLEN len; + switch (op->op_type) { + case OP_GV: + case OP_GVSV: { + GV *gv = cGVOPx_gv(op); + name = GvNAME(gv); + len = GvNAMELEN(gv); + break; + } + default: { + SV *sv = cSVOPx_sv(op); + if (SvPOK(sv) && (SvTYPE(sv) >= SVt_PV)) + name = SvPV_const(sv, len); + break; + } + } + if (name) { SV *sv = sv_2mortal(newSVpvn("$", 1)); - sv_catsv(sv, name); + sv_catpvn(sv, name, len); + o = CALL_FPTR(indirect_old_ck_rv2sv)(aTHX_ o); indirect_map_store(o, indirect_find(sv, PL_parser->oldbufptr), sv); + return o; } }