summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2021-08-31 03:24:43 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2021-08-31 04:02:25 +0200
commit5d46c7a934abff0fc54a24ba8c50d20c6e162975 (patch)
tree68619f3fe93f66a2381da180d618670f4d60b153
parentddc5192f0caaaa79f1d32cd6b729a23c8140989f (diff)
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>
-rw-r--r--man3/malloc.317
1 files changed, 11 insertions, 6 deletions
diff --git a/man3/malloc.3 b/man3/malloc.3
index fe88948d1..98d7cca0e 100644
--- a/man3/malloc.3
+++ b/man3/malloc.3
@@ -58,6 +58,7 @@ Feature Test Macro Requirements for glibc (see
_GNU_SOURCE
.fi
.SH DESCRIPTION
+.SS malloc()
The
.BR malloc ()
function allocates
@@ -71,7 +72,7 @@ is 0, then
returns a unique pointer value that can later be successfully passed to
.BR free ().
(See "Nonportable behavior" for portability issues.)
-.PP
+.SS free()
The
.BR free ()
function frees the memory space pointed to by
@@ -85,7 +86,7 @@ has already been freed, undefined behavior occurs.
If
.I ptr
is NULL, no operation is performed.
-.PP
+.SS calloc()
The
.BR calloc ()
function allocates memory for an array of
@@ -102,6 +103,7 @@ is 0, then
.BR calloc ()
returns a unique pointer value that can later be successfully passed to
.BR free ().
+.PP
If the multiplication of
.I nmemb
and
@@ -119,7 +121,7 @@ with the result that an incorrectly sized block of memory would be allocated:
malloc(nmemb * size);
.EE
.in
-.PP
+.SS realloc()
The
.BR realloc ()
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
.I not
be initialized.
+.PP
If
.I ptr
is NULL, then the call is equivalent to
.IR malloc(size) ,
for all values of
-.IR size ;
-if
+.IR size .
+.PP
+If
.I size
is equal to zero,
and
@@ -146,6 +150,7 @@ and
is not NULL, then the call is equivalent to
.I free(ptr)
(but see "Nonportable behavior" for portability issues).
+.PP
Unless
.I ptr
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
.I free(ptr)
is done.
-.PP
+.SS reallocarray()
The
.BR reallocarray ()
function changes the size of the memory block pointed to by