diff options
author | Karl Williamson <khw@cpan.org> | 2022-05-11 18:18:34 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-05-18 05:08:58 -0600 |
commit | 97b831e4f445dac74b2341d28d35abcc9613582a (patch) | |
tree | 0d83c60cf1601dab48f59eb1af81d2afe32a0e2c /malloc.c | |
parent | 1f3d7af79a87b305e96168c15bdb464f5b1663ee (diff) | |
download | perl-97b831e4f445dac74b2341d28d35abcc9613582a.tar.gz |
perlapi: Mark internal and better document some memory fcns
Perl_(([cm]|re)alloc|mfree) should not be used by the public; instead
there are macros that these implement.
The *alloc functions weren't documented, because of an erroneous
assumption; erroneous because all require the Perl_ preface to call
them.
Diffstat (limited to 'malloc.c')
-rw-r--r-- | malloc.c | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -1223,11 +1223,10 @@ S_adjust_size_and_find_bucket(size_t *nbytes_p) } /* -These have the same interfaces as the C lib ones, so are considered documented - =for apidoc malloc -=for apidoc calloc -=for apidoc realloc + +Implements L<perlapi/C<Newx>> which you should use instead. + =cut */ @@ -1796,6 +1795,14 @@ morecore(int bucket) #endif /* !PACK_MALLOC */ } +/* +=for apidoc mfree + +Implements L<perlapi/C<Safefree>> which you should use instead. + +=cut +*/ + Free_t Perl_mfree(Malloc_t where) { @@ -1886,6 +1893,14 @@ Perl_mfree(Malloc_t where) MALLOC_UNLOCK; } +/* +=for apidoc realloc + +Implements L<perlapi/C<Renew>> which you should use instead. + +=cut +*/ + /* There is no need to do any locking in realloc (with an exception of trying to grow in place if we are at the end of the chain). If somebody calls us from a different thread with the same address, @@ -2083,6 +2098,14 @@ Perl_realloc(void *mp, size_t nbytes) return ((Malloc_t)res); } +/* +=for apidoc calloc + +Implements L<perlapi/C<Newxz>> which you should use instead. + +=cut +*/ + Malloc_t Perl_calloc(size_t elements, size_t size) { |