malloc.3: Add some structuring to improve readability

Add some subsection (.SS) headings and paragraph breaks in
DESCRIPTION, to make the page more easily readable.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-08-31 03:24:43 +02:00
parent ddc5192f0c
commit 5d46c7a934
1 changed files with 11 additions and 6 deletions

View File

@ -58,6 +58,7 @@ Feature Test Macro Requirements for glibc (see
_GNU_SOURCE _GNU_SOURCE
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.SS malloc()
The The
.BR malloc () .BR malloc ()
function allocates function allocates
@ -71,7 +72,7 @@ is 0, then
returns a unique pointer value that can later be successfully passed to returns a unique pointer value that can later be successfully passed to
.BR free (). .BR free ().
(See "Nonportable behavior" for portability issues.) (See "Nonportable behavior" for portability issues.)
.PP .SS free()
The The
.BR free () .BR free ()
function frees the memory space pointed to by function frees the memory space pointed to by
@ -85,7 +86,7 @@ has already been freed, undefined behavior occurs.
If If
.I ptr .I ptr
is NULL, no operation is performed. is NULL, no operation is performed.
.PP .SS calloc()
The The
.BR calloc () .BR calloc ()
function allocates memory for an array of function allocates memory for an array of
@ -102,6 +103,7 @@ is 0, then
.BR calloc () .BR calloc ()
returns a unique pointer value that can later be successfully passed to returns a unique pointer value that can later be successfully passed to
.BR free (). .BR free ().
.PP
If the multiplication of If the multiplication of
.I nmemb .I nmemb
and and
@ -119,7 +121,7 @@ with the result that an incorrectly sized block of memory would be allocated:
malloc(nmemb * size); malloc(nmemb * size);
.EE .EE
.in .in
.PP .SS realloc()
The The
.BR realloc () .BR realloc ()
function changes the size of the memory block pointed to by function changes the size of the memory block pointed to by
@ -132,13 +134,15 @@ up to the minimum of the old and new sizes.
If the new size is larger than the old size, the added memory will If the new size is larger than the old size, the added memory will
.I not .I not
be initialized. be initialized.
.PP
If If
.I ptr .I ptr
is NULL, then the call is equivalent to is NULL, then the call is equivalent to
.IR malloc(size) , .IR malloc(size) ,
for all values of for all values of
.IR size ; .IR size .
if .PP
If
.I size .I size
is equal to zero, is equal to zero,
and and
@ -146,6 +150,7 @@ and
is not NULL, then the call is equivalent to is not NULL, then the call is equivalent to
.I free(ptr) .I free(ptr)
(but see "Nonportable behavior" for portability issues). (but see "Nonportable behavior" for portability issues).
.PP
Unless Unless
.I ptr .I ptr
is NULL, it must have been returned by an earlier call to is NULL, it must have been returned by an earlier call to
@ -154,7 +159,7 @@ or related functions.
If the area pointed to was moved, a If the area pointed to was moved, a
.I free(ptr) .I free(ptr)
is done. is done.
.PP .SS reallocarray()
The The
.BR reallocarray () .BR reallocarray ()
function changes the size of the memory block pointed to by function changes the size of the memory block pointed to by