diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2020-11-02 22:52:19 +0000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2020-11-04 00:27:29 +0000 |
commit | f73391e47e605dbc951ddd9776e3c8c25686d2d7 (patch) | |
tree | 90f3c536a12e0e4dd1aa6ecac7abd32228301390 /av.c | |
parent | b73caddf6779a7f7c36ca44e496b2b9498c657de (diff) | |
download | perl-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.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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; |