]> git.vpit.fr Git - perl/modules/Scope-Upper.git/commitdiff
Don't hardcode the length of NEGATIVE_INDICES_VAR
authorVincent Pit <vince@profvince.com>
Tue, 18 Aug 2015 13:53:27 +0000 (10:53 -0300)
committerVincent Pit <vince@profvince.com>
Tue, 18 Aug 2015 13:53:27 +0000 (10:53 -0300)
Upper.xs

index 823b32e38a6556f6f486baec573d2b387467b85c..01d0270bf59855f1442724c98d17e8e26272e2d7 100644 (file)
--- a/Upper.xs
+++ b/Upper.xs
@@ -576,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;
   }