In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/17b0bd7713345613d9d19e31a82f42fc48ddcfc5?hp=d12be05dd0210a08e077f0cc9586a5a963122547>
- Log ----------------------------------------------------------------- commit 17b0bd7713345613d9d19e31a82f42fc48ddcfc5 Author: David Mitchell <[email protected]> Date: Tue Sep 27 09:51:45 2016 +0100 fixup some AV API pod descriptions. In particular: * improve some of the "perl equivalent" entries; for example av_store() is *not* like $myarray[$key] = $val, since it replaces the stored SV with a different SV, rather than just updating the current SV's value. * Also change the "perl equivalent" variable names to match the function parameter names, e.g. $key rather than $idx. * Don't use 'delete' as a perl equivalent, since delete is discouraged on arrays. * You don't *have* to use av_store() to change undef values inserted by av_unshift; e.g. you could do av_fetch() then modify the returned undef SV; so just delete that sentence M av.c commit 8944d2e9909e3336200cbf2ead2a819cc78f4986 Author: David Mitchell <[email protected]> Date: Tue Sep 27 09:27:30 2016 +0100 perldelta for PADOFFSET changes M pod/perldelta.pod ----------------------------------------------------------------------- Summary of changes: av.c | 23 ++++++++++++----------- pod/perldelta.pod | 4 +++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/av.c b/av.c index 21828a9..882be18 100644 --- a/av.c +++ b/av.c @@ -210,7 +210,7 @@ value is non-null before dereferencing it to a C<SV*>. See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more information on how to use this function on tied arrays. -The rough perl equivalent is C<$myarray[$idx]>. +The rough perl equivalent is C<$myarray[$key]>. =cut */ @@ -305,7 +305,7 @@ Note that the caller is responsible for suitably incrementing the reference count of C<val> before the call, and decrementing it if the function returned C<NULL>. -Approximate Perl equivalent: C<$myarray[$key] = $val;>. +Approximate Perl equivalent: C<splice(@myarray, $key, 1, $val)>. See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more information on how to use this function on tied arrays. @@ -573,7 +573,7 @@ Perl_av_create_and_push(pTHX_ AV **const avp, SV *const val) Pushes an SV (transferring control of one reference count) onto the end of the array. The array will grow automatically to accommodate the addition. -Perl equivalent: C<push @myarray, $elem;>. +Perl equivalent: C<push @myarray, $val;>. =cut */ @@ -661,10 +661,9 @@ Perl_av_create_and_unshift_one(pTHX_ AV **const avp, SV *const val) =for apidoc av_unshift Unshift the given number of C<undef> values onto the beginning of the -array. The array will grow automatically to accommodate the addition. You -must then use C<av_store> to assign values to these new elements. +array. The array will grow automatically to accommodate the addition. -Perl equivalent: S<C<unshift @myarray, ( (undef) x $n );>> +Perl equivalent: S<C<unshift @myarray, ((undef) x $num);>> =cut */ @@ -848,11 +847,13 @@ Perl_av_fill(pTHX_ AV *av, SSize_t fill) /* =for apidoc av_delete -Deletes the element indexed by C<key> from the array, makes the element mortal, -and returns it. If C<flags> equals C<G_DISCARD>, the element is freed and null -is returned. Perl equivalent: S<C<my $elem = delete($myarray[$idx]);>> for the -non-C<G_DISCARD> version and a void-context S<C<delete($myarray[$idx]);>> for the -C<G_DISCARD> version. +Deletes the element indexed by C<key> from the array, makes the element +mortal, and returns it. If C<flags> equals C<G_DISCARD>, the element is +freed and NULL is returned. NULL is also returned if C<key> is out of +range. + +Perl equivalent: S<C<splice(@myarray, $key, 1, undef)>> (with the +C<splice> in void context if C<G_DISCARD> is present). =cut */ diff --git a/pod/perldelta.pod b/pod/perldelta.pod index a8ec6a8..2c3986b 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -322,7 +322,9 @@ well. =item * -XXX +The C<PADOFFSET> type has changed from being unsigned to signed, and +several pad-related variables such as C<PL_padix> have changed from being +of type C<I32> to type C<PADOFFSET>. =back -- Perl5 Master Repository
