From a4395ebabc865511588235b5953dce6cc458ed3c Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Tue, 6 Oct 2015 11:50:06 +0100 Subject: Improve pod for [ah]v_(clear|undef) See [perl #117341]. --- av.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'av.c') diff --git a/av.c b/av.c index 2c4740b621..9a5644a0e2 100644 --- a/av.c +++ b/av.c @@ -436,11 +436,15 @@ Perl_av_make(pTHX_ SSize_t size, SV **strp) /* =for apidoc av_clear -Clears an array, making it empty. Does not free the memory C uses to -store its list of scalars. If any destructors are triggered as a result, -C itself may be freed when this function returns. +Frees the all the elements of an array, leaving it empty. +The XS equivalent of C<@array = ()>. See also L. -Perl equivalent: C<@myarray = ();>. +Note that it is possible that the actions of a destructor called directly +or indirectly by freeing an element of the array could cause the reference +count of the array itself to be reduced (e.g. by deleting an entry in the +symbol table). So it is a possibility that the AV could have been freed +(or even reallocated) on return from the call unless you hold a reference +to it. =cut */ @@ -500,9 +504,13 @@ Perl_av_clear(pTHX_ AV *av) /* =for apidoc av_undef -Undefines the array. Frees the memory used by the av to store its list of -scalars. If any destructors are triggered as a result, C itself may -be freed. +Undefines the array. The XS equivalent of C. + +As well as freeing all the elements of the array (like C), this +also frees the memory used by the av to store its list of scalars. + +See L for a note about the array possibly being invalid on +return. =cut */ -- cgit v1.2.1