X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=blobdiff_plain;f=indirect.xs;h=45309ce648a1cf43b3b0cccd4a31b076d864a616;hp=01b4a77ab3494923b1b1297b39a662f9c3029744;hb=8e1c49f42da7671812398f92d819da04c7a41e1b;hpb=eb4b05d5ad6eec232107b4688e59685bc54f7a65 diff --git a/indirect.xs b/indirect.xs index 01b4a77..45309ce 100644 --- a/indirect.xs +++ b/indirect.xs @@ -351,6 +351,10 @@ STATIC U32 indirect_hash = 0; STATIC SV *indirect_hint(pTHX) { #define indirect_hint() indirect_hint(aTHX) SV *hint; + + if (IN_PERL_RUNTIME) + return NULL; + #if I_HAS_PERL(5, 9, 5) hint = Perl_refcounted_he_fetch(aTHX_ PL_curcop->cop_hints_hash, NULL, @@ -358,11 +362,13 @@ STATIC SV *indirect_hint(pTHX) { 0, indirect_hash); #else - SV **val = hv_fetch(GvHV(PL_hintgv), __PACKAGE__, __PACKAGE_LEN__, + { + SV **val = hv_fetch(GvHV(PL_hintgv), __PACKAGE__, __PACKAGE_LEN__, indirect_hash); - if (!val) - return 0; - hint = *val; + if (!val) + return 0; + hint = *val; + } #endif return indirect_detag(hint); } @@ -604,6 +610,16 @@ done: /* ... ck_entersub ......................................................... */ +STATIC int indirect_is_indirect(const indirect_op_info_t *moi, const indirect_op_info_t *ooi) { + if (moi->pos > ooi->pos) + return 0; + + if (moi->pos == ooi->pos) + return moi->len == ooi->len && !memcmp(moi->buf, ooi->buf, moi->len); + + return 1; +} + STATIC OP *(*indirect_old_ck_entersub)(pTHX_ OP *) = 0; STATIC OP *indirect_ck_entersub(pTHX_ OP *o) { @@ -651,7 +667,7 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) { if (!(ooi && ooi->pos)) goto done; - if (moi->pos < ooi->pos) { + if (indirect_is_indirect(moi, ooi)) { SV *file; dSP;