From 5d46c7a934abff0fc54a24ba8c50d20c6e162975 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 31 Aug 2021 03:24:43 +0200 Subject: [PATCH] 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 --- man3/malloc.3 | 17 +++++++++++------ 1 file 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