Skip to content

Commit

Permalink
Merge f9be504 into dace60f
Browse files Browse the repository at this point in the history
  • Loading branch information
richardleach committed Apr 13, 2021
2 parents dace60f + f9be504 commit 72985d9
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions pad.c
Expand Up @@ -712,7 +712,13 @@ Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype)
pad_reset();
if (tmptype == SVs_PADMY) { /* Not & because this ‘flag’ is 0. */
/* For a my, simply push a null SV onto the end of PL_comppad. */
sv = *av_fetch(PL_comppad, AvFILLp(PL_comppad) + 1, TRUE);
SSize_t key = AvFILLp(PL_comppad) + 1;
if (key > AvMAX(PL_comppad))
av_extend(PL_comppad,key);

sv = AvARRAY(PL_comppad)[key] = newSV(0);

AvFILLp(PL_comppad) = key;
retval = (PADOFFSET)AvFILLp(PL_comppad);
}
else {
Expand All @@ -739,7 +745,22 @@ Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype)
if (++retval <= names_fill &&
(pn = names[retval]) && PadnamePV(pn))
continue;
sv = *av_fetch(PL_comppad, retval, TRUE);

if ( retval > AvFILLp(PL_comppad) ) {
if (retval > AvMAX(PL_comppad))
av_extend(PL_comppad,retval);

AvFILLp(PL_comppad) = retval;
AvARRAY(PL_comppad)[retval] = newSV(0);

} else if (!AvARRAY(PL_comppad)[retval] ) {

SvREFCNT_dec(AvARRAY(PL_comppad)[retval]);
AvARRAY(PL_comppad)[retval] = newSV(0);

}
sv = AvARRAY(PL_comppad)[retval];

if (!(SvFLAGS(sv) &
#ifdef USE_PAD_RESET
(konst ? SVs_PADTMP : 0)
Expand Down

0 comments on commit 72985d9

Please sign in to comment.