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