[PATCH v3 3/4] Say malloc (0) != NULL is now common; resection

Florian Weimer fweimer@redhat.com
Thu Feb 26 13:15:08 GMT 2026


* Paul Eggert:

> * manual/memory.texi (Portable Allocation):
> New section, split off from Malloc Examples.
> Say that almost every system follows glibc's example
> in having successful malloc (0) return non-null;
> AIX is the only exception nowadays.
> Document fundamental alignment portability.
> Have examples match the new text, and use NULL rather than 0.
> ---
>  manual/memory.texi | 130 +++++++++++++++++++++++++++++++--------------
>  1 file changed, 91 insertions(+), 39 deletions(-)
>
> diff --git a/manual/memory.texi b/manual/memory.texi
> index 614cdc4e46..935df79e9c 100644
> --- a/manual/memory.texi
> +++ b/manual/memory.texi
> @@ -318,6 +318,7 @@ any time (or never).
>  @menu
>  * Basic Allocation::            Simple use of @code{malloc}.
>  * Malloc Examples::             Examples of @code{malloc}.  @code{xmalloc}.
> +* Portable Allocation::         Portable use of @code{malloc}.
>  * Freeing after Malloc::        Use @code{free} to free a block you
>  				 got with @code{malloc}.
>  * Changing Block Size::         Use @code{realloc} to make a block

Looks okay to me.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list