summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2020-11-02 22:52:19 +0000
committerTony Cook <tony@develop-help.com>2020-11-04 00:27:29 +0000
commitf73391e47e605dbc951ddd9776e3c8c25686d2d7 (patch)
tree90f3c536a12e0e4dd1aa6ecac7abd32228301390 /av.c
parentb73caddf6779a7f7c36ca44e496b2b9498c657de (diff)
downloadperl-f73391e47e605dbc951ddd9776e3c8c25686d2d7.tar.gz
av_make: remove unnecessary AvFILLp assignment
av_make sets `AvFILLp(av)= -1;`, but will already have been set by `newAV()`, via `newSV_type`'s call to `sv_upgrade`. This PR also includes the minor cosmetic change of swapping in `newAV()` in place of its expansion, seemingly the only occurrence of that in core.
Diffstat (limited to 'av.c')
-rw-r--r--av.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/av.c b/av.c
index 24295eacc9..b0a4d8d1cb 100644
--- a/av.c
+++ b/av.c
@@ -410,7 +410,7 @@ Perl equivalent: C<my @new_array = ($scalar1, $scalar2, $scalar3...);>
AV *
Perl_av_make(pTHX_ SSize_t size, SV **strp)
{
- AV * const av = MUTABLE_AV(newSV_type(SVt_PVAV));
+ AV * const av = newAV();
/* sv_upgrade does AvREAL_only() */
PERL_ARGS_ASSERT_AV_MAKE;
assert(SvTYPE(av) == SVt_PVAV);
@@ -424,7 +424,6 @@ Perl_av_make(pTHX_ SSize_t size, SV **strp)
AvALLOC(av) = ary;
AvARRAY(av) = ary;
AvMAX(av) = size - 1;
- AvFILLp(av) = -1;
/* avoid av being leaked if croak when calling magic below */
EXTEND_MORTAL(1);
PL_tmps_stack[++PL_tmps_ix] = (SV*)av;