void
Perl_av_extend(pTHX_ AV *av, I32 key)
{
- MAGIC *mg;
- if ((mg = SvTIED_mg((SV*)av, PERL_MAGIC_tied))) {
+ MAGIC * const mg = SvTIED_mg((SV*)av, PERL_MAGIC_tied);
+ if (mg) {
dSP;
ENTER;
SAVETMPS;
while (tmp)
ary[--tmp] = &PL_sv_undef;
}
-
if (key > AvMAX(av) - 10) {
newmax = key + AvMAX(av);
goto resize;
if (tied_magic && key < 0) {
/* Handle negative array indices 20020222 MJD */
- SV **negative_indices_glob =
+ SV * const * const negative_indices_glob =
hv_fetch(SvSTASH(SvRV(SvTIED_obj((SV *)av,
tied_magic))),
NEGATIVE_INDICES_VAR, 16, 0);
/* Handle negative array indices 20020222 MJD */
if (key < 0) {
unsigned adjust_index = 1;
- SV **negative_indices_glob =
+ SV * const * const negative_indices_glob =
hv_fetch(SvSTASH(SvRV(SvTIED_obj((SV *)av,
tied_magic))),
NEGATIVE_INDICES_VAR, 16, 0);
AV *
Perl_newAV(pTHX)
{
- register AV *av;
+ register AV * const av = (AV*)NEWSV(3,0);
- av = (AV*)NEWSV(3,0);
sv_upgrade((SV *)av, SVt_PVAV);
/* sv_upgrade does AvREAL_only() */
AvALLOC(av) = 0;
AV *
Perl_av_make(pTHX_ register I32 size, register SV **strp)
{
- register AV *av;
+ register AV * const av = (AV*)NEWSV(8,0);
- av = (AV*)NEWSV(8,0);
sv_upgrade((SV *) av,SVt_PVAV);
/* sv_upgrade does AvREAL_only() */
if (size) { /* "defined" was returning undef for size==0 anyway. */
AV *
Perl_av_fake(pTHX_ register I32 size, register SV **strp)
{
- register AV *av;
register SV** ary;
+ register AV * const av = (AV*)NEWSV(9,0);
- av = (AV*)NEWSV(9,0);
sv_upgrade((SV *)av, SVt_PVAV);
Newx(ary,size+1,SV*);
AvALLOC(av) = ary;
return;
if (AvREAL(av)) {
- SV** ary = AvARRAY(av);
+ SV** const ary = AvARRAY(av);
key = AvFILLp(av) + 1;
while (key) {
- SV * sv = ary[--key];
+ SV * const sv = ary[--key];
/* undef the slot before freeing the value, because a
* destructor might try to modify this arrray */
ary[key] = &PL_sv_undef;
AvALLOC(av) = 0;
SvPV_set(av, (char*)0);
AvMAX(av) = AvFILLp(av) = -1;
- /* It's in magic - it must already be gone. */
- assert (!AvARYLEN(av));
}
/*
*/
I32
-Perl_av_len(pTHX_ const register AV *av)
+Perl_av_len(pTHX_ register const AV *av)
{
return AvFILL(av);
}
if (key < 0) {
unsigned adjust_index = 1;
if (tied_magic) {
- SV **negative_indices_glob =
+ SV * const * const negative_indices_glob =
hv_fetch(SvSTASH(SvRV(SvTIED_obj((SV *)av,
tied_magic))),
NEGATIVE_INDICES_VAR, 16, 0);
if (key < 0) {
unsigned adjust_index = 1;
if (tied_magic) {
- SV **negative_indices_glob =
+ SV * const * const negative_indices_glob =
hv_fetch(SvSTASH(SvRV(SvTIED_obj((SV *)av,
tied_magic))),
NEGATIVE_INDICES_VAR, 16, 0);