Mark up NULL and ENOMEM.

This commit is contained in:
wiz 2002-08-20 16:15:38 +00:00
parent 3f9c36b9de
commit 60bfa780a0

View File

@ -1,4 +1,4 @@
.\" $NetBSD: malloc.3,v 1.16 2002/08/11 06:12:45 yamt Exp $
.\" $NetBSD: malloc.3,v 1.17 2002/08/20 16:15:38 wiz Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -80,8 +80,10 @@ bytes in length (see
the returned memory will be page boundary aligned as well.
If
.Fn malloc
fails, a NULL pointer is returned, and the errno variable is
set to ENOMEM.
fails, a
.Dv NULL
pointer is returned, and the errno variable is set to
.Er ENOMEM .
.Pp
The
.Fn calloc
@ -108,13 +110,16 @@ The contents of the memory are unchanged up to the lesser of the new and
old sizes.
If the new size is larger,
the value of the newly allocated portion of the memory is undefined.
If the requested memory cannot be allocated, NULL is returned and
the memory referenced by
If the requested memory cannot be allocated,
.Dv NULL
is returned and the memory referenced by
.Fa ptr
is valid and unchanged.
If
.Fa ptr
is NULL, the
is
.Dv NULL ,
the
.Fn realloc
function behaves identically to
.Fn malloc
@ -159,7 +164,9 @@ function causes the allocated memory referenced by
to be made available for future allocations.
If
.Fa ptr
is NULL, no action occurs.
is
.Dv NULL ,
no action occurs.
.Sh TUNING
Once, when the first call is made to one of these memory allocation
routines, various flags will be set or reset, which affect the
@ -227,8 +234,9 @@ entries for
for all operations.
Consult the source for details on this option.
.It V
Attempting to allocate zero bytes will return a NULL pointer instead of
a valid pointer.
Attempting to allocate zero bytes will return a
.Dv NULL
pointer instead of a valid pointer.
(The default behavior is to make a minimal allocation and return a
pointer to it.)
This option is provided for System V compatibility.
@ -272,8 +280,9 @@ The
.Fn malloc
and
.Fn calloc
functions return a pointer to the allocated memory if successful; otherwise
a NULL pointer is returned and
functions return a pointer to the allocated memory if successful; otherwise a
.Dv NULL
pointer is returned and
.Va errno
is set to
.Er ENOMEM .
@ -286,8 +295,9 @@ The
function returns
a pointer, possibly identical to
.Fa ptr ,
to the allocated memory
if successful; otherwise a NULL pointer is returned and
to the allocated memory if successful; otherwise a
.Dv NULL
pointer is returned and
.Va errno
is set to
.Er ENOMEM ,