[inseparable changes from patch to perl 5.004_04]
[p5sagit/p5-mst-13.2.git] / av.c
diff --git a/av.c b/av.c
index 6b4c03d..4a87eaf 100644 (file)
--- a/av.c
+++ b/av.c
 #include "EXTERN.h"
 #include "perl.h"
 
-static void    av_reify _((AV* av));
-
-static void
+void
 av_reify(av)
 AV* av;
 {
     I32 key;
     SV* sv;
-    
+
+    if (AvREAL(av))
+       return;
     key = AvMAX(av) + 1;
     while (key > AvFILL(av) + 1)
        AvARRAY(av)[--key] = &sv_undef;
@@ -324,6 +324,9 @@ register AV *av;
        SvPVX(av) = (char*)AvALLOC(av);
     }
     AvFILL(av) = -1;
+
+    if (SvRMAGICAL(av))
+       mg_clear((SV*)av); 
 }
 
 void