X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=indirect.xs;h=a9012cdf062582057bbc6e80a72fc83cfc4b6116;hb=9e7e0702d84f54976fa798516817f55e342fe0be;hp=04bc7604b2345db88d3697e62ac331909c1aab10;hpb=833e3f5682e5dfe0f90b390dd14065b850d5fc5d;p=perl%2Fmodules%2Findirect.git diff --git a/indirect.xs b/indirect.xs index 04bc760..a9012cd 100644 --- a/indirect.xs +++ b/indirect.xs @@ -6,6 +6,14 @@ #include "perl.h" #include "XSUB.h" +#ifndef SvPV_const +# define SvPV_const SvPV +#endif + +#ifndef SvPV_nolen_const +# define SvPV_nolen_const SvPV_nolen +#endif + #ifndef SvPVX_const # define SvPVX_const SvPVX #endif @@ -21,7 +29,7 @@ STATIC UV indirect_hint(pTHX) { "indirect", 8, 0, indirect_hash); - return SvOK(id) ? SvUV(id) : 0; + return SvIOK(id) ? SvUV(id) : 0; } /* ... op -> source position ............................................... */ @@ -50,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); } @@ -59,7 +69,7 @@ STATIC const char *indirect_map_fetch(pTHX_ const OP *o, SV ** const name) { char buf[32]; SV **val; - if (indirect_linestr != SvPVX(PL_parser->linestr)) + if (indirect_linestr != SvPVX_const(PL_parser->linestr)) return NULL; val = hv_fetch(indirect_map, buf, sprintf(buf, "%u", PTR2UV(o)), 0); @@ -195,8 +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(svm), SvPV_nolen(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: