This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix obsolete identifiers in comment
[perl5.git] / av.c
diff --git a/av.c b/av.c
index e5cbe2f..1b54065 100644 (file)
--- a/av.c
+++ b/av.c
@@ -132,7 +132,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key)
                assert(itmp > newmax);
                newmax = itmp - 1;
                assert(newmax >= AvMAX(av));
-               New(2,ary, newmax+1, SV*);
+               Newx(ary, newmax+1, SV*);
                Copy(AvALLOC(av), ary, AvMAX(av)+1, SV*);
                if (AvMAX(av) > 64)
                    offer_nice_chunk(AvALLOC(av), (AvMAX(av)+1) * sizeof(SV*));
@@ -154,7 +154,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key)
            else {
                newmax = key < 3 ? 3 : key;
                MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
-               New(2,AvALLOC(av), newmax+1, SV*);
+               Newx(AvALLOC(av), newmax+1, SV*);
                ary = AvALLOC(av) + 1;
                tmp = newmax;
                AvALLOC(av)[0] = &PL_sv_undef;  /* For the stacks */
@@ -358,7 +358,7 @@ Perl_newAV(pTHX)
 
     av = (AV*)NEWSV(3,0);
     sv_upgrade((SV *)av, SVt_PVAV);
-    AvREAL_on(av);
+    /* sv_upgrade does AvREAL_only()  */
     AvALLOC(av) = 0;
     SvPV_set(av, (char*)0);
     AvMAX(av) = AvFILLp(av) = -1;
@@ -382,11 +382,11 @@ Perl_av_make(pTHX_ register I32 size, register SV **strp)
 
     av = (AV*)NEWSV(8,0);
     sv_upgrade((SV *) av,SVt_PVAV);
-    AvREAL_only(av);
+    /* sv_upgrade does AvREAL_only()  */
     if (size) {                /* "defined" was returning undef for size==0 anyway. */
         register SV** ary;
         register I32 i;
-       New(4,ary,size,SV*);
+       Newx(ary,size,SV*);
        AvALLOC(av) = ary;
        SvPV_set(av, (char*)ary);
        AvFILLp(av) = size - 1;
@@ -409,7 +409,7 @@ Perl_av_fake(pTHX_ register I32 size, register SV **strp)
 
     av = (AV*)NEWSV(9,0);
     sv_upgrade((SV *)av, SVt_PVAV);
-    New(4,ary,size+1,SV*);
+    Newx(ary,size+1,SV*);
     AvALLOC(av) = ary;
     Copy(strp,ary,size,SV*);
     AvREIFY_only(av);
@@ -445,7 +445,6 @@ Perl_av_clear(pTHX_ register AV *av)
 #endif
     if (!av)
        return;
-    /*SUPPRESS 560*/
 
     if (SvREADONLY(av))
        Perl_croak(aTHX_ PL_no_modify);
@@ -489,7 +488,6 @@ Perl_av_undef(pTHX_ register AV *av)
 {
     if (!av)
        return;
-    /*SUPPRESS 560*/
 
     /* Give any tie a chance to cleanup first */
     if (SvTIED_mg((SV*)av, PERL_MAGIC_tied)) 
@@ -940,21 +938,14 @@ Perl_av_arylen_p(pTHX_ AV *av) {
     MAGIC *mg = mg_find((SV*)av, PERL_MAGIC_arylen_p);
 
     if (!mg) {
-       mg = sv_magicext((SV*)av, 0, PERL_MAGIC_arylen_p, 0, 0, 0);
+       mg = sv_magicext((SV*)av, 0, PERL_MAGIC_arylen_p, &PL_vtbl_arylen_p,
+                        0, 0);
 
        if (!mg) {
            Perl_die(aTHX_ "panic: av_arylen_p");
        }
        /* sv_magicext won't set this for us because we pass in a NULL obj  */
        mg->mg_flags |= MGf_REFCOUNTED;
-
-       /* This is very naughty, but we don't want SvRMAGICAL() set on the
-          hash, because it slows down all accesses.  If we pass in a vtable
-          to sv_magicext then it is (correctly) set for us.  However, the only
-          entry in our vtable is for free, and mg_free always calls the free
-          vtable entry irrespective of the flags, so it doesn't actually
-          matter that the R flag is off.  */
-       mg->mg_virtual = &PL_vtbl_arylen_p;
     }
     return &(mg->mg_obj);
 }