newSV_type() and tweaking Perl_sv_upgrade().
p4raw-id: //depot/perl@32675
}
/*
-=for apidoc newAV
-
-Creates a new AV. The reference count is set to 1.
-
-=cut
-*/
-
-AV *
-Perl_newAV(pTHX)
-{
- register AV * const av = (AV*)newSV_type(SVt_PVAV);
- /* sv_upgrade does AvREAL_only() */
- AvALLOC(av) = 0;
- AvARRAY(av) = NULL;
- AvMAX(av) = AvFILLp(av) = -1;
- return av;
-}
-
-/*
=for apidoc av_make
Creates a new AV and populates it with a list of SVs. The SVs are copied
#define NEGATIVE_INDICES_VAR "NEGATIVE_INDICES"
/*
+=for apidoc newAV
+
+Creates a new AV. The reference count is set to 1.
+
+=cut
+*/
+
+#define newAV() ((AV *)newSV_type(SVt_PVAV))
+
+/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
|NN const char *const filename \
|NULLOK const char *const proto|U32 flags
Apd |CV* |newXS |NULLOK const char* name|NN XSUBADDR_t f|NN const char* filename
-Apda |AV* |newAV
+Amdba |AV* |newAV
Apa |OP* |newAVREF |NN OP* o
Apa |OP* |newBINOP |I32 type|I32 flags|NULLOK OP* first|NULLOK OP* last
Apa |OP* |newCVREF |I32 flags|NULLOK OP* o
#define newSUB Perl_newSUB
#define newXS_flags Perl_newXS_flags
#define newXS Perl_newXS
-#define newAV Perl_newAV
#define newAVREF Perl_newAVREF
#define newBINOP Perl_newBINOP
#define newCVREF Perl_newCVREF
#define newSUB(a,b,c,d) Perl_newSUB(aTHX_ a,b,c,d)
#define newXS_flags(a,b,c,d,e) Perl_newXS_flags(aTHX_ a,b,c,d,e)
#define newXS(a,b,c) Perl_newXS(aTHX_ a,b,c)
-#define newAV() Perl_newAV(aTHX)
#define newAVREF(a) Perl_newAVREF(aTHX_ a)
#define newBINOP(a,b,c,d) Perl_newBINOP(aTHX_ a,b,c,d)
#define newCVREF(a,b) Perl_newCVREF(aTHX_ a,b)
PERL_CALLCONV int Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...);
PERL_CALLCONV int Perl_printf_nocontext(const char *format, ...);
PERL_CALLCONV int Perl_magic_setglob(pTHX_ SV* sv, MAGIC* mg);
-
+PERL_CALLCONV AV * Perl_newAV(pTHX);
/* ref() is now a macro using Perl_doref;
* this version provided for binary compatibility only.
return 0;
}
+AV *
+Perl_newAV(pTHX)
+{
+ return (AV*)newSV_type(SVt_PVAV);
+ /* sv_upgrade does AvREAL_only():
+ AvALLOC(av) = 0;
+ AvARRAY(av) = NULL;
+ AvMAX(av) = AvFILLp(av) = -1; */
+}
+
#endif /* NO_MATHOMS */
/*
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3);
-PERL_CALLCONV AV* Perl_newAV(pTHX)
+/* PERL_CALLCONV AV* Perl_newAV(pTHX)
__attribute__malloc__
- __attribute__warn_unused_result__;
+ __attribute__warn_unused_result__; */
PERL_CALLCONV OP* Perl_newAVREF(pTHX_ OP* o)
__attribute__malloc__
AvMAX(sv) = -1;
AvFILLp(sv) = -1;
AvREAL_only(sv);
+ if (old_type >= SVt_RV) {
+ AvALLOC(sv) = 0;
+ } else {
+ /* It will have been zeroed when the new body was allocated.
+ Lets not write to it, in case it confuses a write-back
+ cache. */
+ }
}
/* SVt_NULL isn't the only thing upgraded to AV or HV.