X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=indirect.xs;h=2d02563f3fe1f437801d0a3887a699a2d05ee3ab;hb=b78d08a728ad517a03a0b7302f45201964654488;hp=1e546d6041e83bc95d1ddcfa547f2afc72751cb2;hpb=1a28b9e5abd56be968ae09e9d45327632f1a28c8;p=perl%2Fmodules%2Findirect.git diff --git a/indirect.xs b/indirect.xs index 1e546d6..2d02563 100644 --- a/indirect.xs +++ b/indirect.xs @@ -22,14 +22,14 @@ STATIC U32 indirect_hash = 0; -STATIC UV indirect_hint(pTHX) { +STATIC IV indirect_hint(pTHX) { #define indirect_hint() indirect_hint(aTHX) SV *id = Perl_refcounted_he_fetch(aTHX_ PL_curcop->cop_hints_hash, NULL, "indirect", 8, 0, indirect_hash); - return SvOK(id) ? SvUV(id) : 0; + return (id && SvOK(id) && SvIOK(id)) ? SvIV(id) : 0; } /* ... op -> source position ............................................... */ @@ -58,6 +58,8 @@ STATIC void indirect_map_store(pTHX_ const OP *o, const char *src, SV *sv) { val = newSVsv(sv); SvUPGRADE(val, SVt_PVIV); SvUVX(val) = PTR2UV(src); + SvIOK_on(val); + SvIsUV_on(val); if (!hv_store(indirect_map, buf, sprintf(buf, "%u", PTR2UV(o)), val, 0)) SvREFCNT_dec(val); } @@ -185,7 +187,7 @@ STATIC OP *(*indirect_old_ck_entersub)(pTHX_ OP *) = 0; STATIC OP *indirect_ck_entersub(pTHX_ OP *o) { LISTOP *op; OP *om, *oo; - UV hint = indirect_hint(); + IV hint = indirect_hint(); if (hint) { const char *pm, *po; @@ -203,9 +205,13 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) { goto done; pm = indirect_map_fetch(om, &svm); po = indirect_map_fetch(oo, &svo); - if (pm && po && pm < po) - ((hint == 2) ? croak : warn)(indirect_msg, SvPV_nolen_const(svm), - SvPV_nolen_const(svo)); + if (pm && po && pm < po) { + const char *psvm = SvPV_nolen_const(svm), *psvo = SvPV_nolen_const(svo); + if (hint == 2) + croak(indirect_msg, psvm, psvo); + else + warn(indirect_msg, psvm, psvo); + } } done: