This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
store AV iterator as mg_len in more cases
[perl5.git] / mg.c
diff --git a/mg.c b/mg.c
index a133943..a359ebf 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2184,12 +2184,12 @@ Perl_magic_cleararylen_p(pTHX_ SV *sv, MAGIC *mg)
     PERL_UNUSED_CONTEXT;
 
     /* Reset the iterator when the array is cleared */
-#if IVSIZE == I32SIZE
-    *((IV *) &(mg->mg_len)) = 0;
-#else
-    if (mg->mg_ptr)
-        *((IV *) mg->mg_ptr) = 0;
-#endif
+    if (sizeof(IV) == sizeof(SSize_t)) {
+       *((IV *) &(mg->mg_len)) = 0;
+    } else {
+       if (mg->mg_ptr)
+           *((IV *) mg->mg_ptr) = 0;
+    }
 
     return 0;
 }