X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Upper.xs;h=01d0270bf59855f1442724c98d17e8e26272e2d7;hb=e80ff1232c20d31735ab14200c391c7dca3f396b;hp=f85cc54d6db3294fb905092cf9a2545115230fe3;hpb=8596ba5e15fc913103009f3cd5a0aa996e0075ab;p=perl%2Fmodules%2FScope-Upper.git diff --git a/Upper.xs b/Upper.xs index f85cc54..01d0270 100644 --- a/Upper.xs +++ b/Upper.xs @@ -54,9 +54,12 @@ # define SU_D(X) STMT_START X STMT_END static void su_debug_log(const char *fmt, ...) { va_list va; + SV *sv; dTHX; va_start(va, fmt); - PerlIO_vprintf(Perl_debug_log, fmt, va); + sv = get_sv(__PACKAGE__ "::DEBUG", 0); + if (sv && SvTRUE(sv)) + PerlIO_vprintf(Perl_debug_log, fmt, va); va_end(va); return; } @@ -573,9 +576,10 @@ static I32 su_av_key2idx(pTHX_ AV *av, I32 key) { if (SvRMAGICAL(av)) { const MAGIC * const tied_magic = mg_find((SV *) av, PERL_MAGIC_tied); if (tied_magic) { - SV * const * const negative_indices_glob = - hv_fetch(SvSTASH(SvRV(SvTIED_obj((SV *) (av), tied_magic))), - NEGATIVE_INDICES_VAR, 16, 0); + SV * const * const negative_indices_glob = hv_fetch( + SvSTASH(SvRV(SvTIED_obj((SV *) (av), tied_magic))), + NEGATIVE_INDICES_VAR, sizeof(NEGATIVE_INDICES_VAR)-1, 0 + ); if (negative_indices_glob && SvTRUE(GvSV(*negative_indices_glob))) return key; }