Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib Mark up NULL and ENOMEM.
details: https://anonhg.NetBSD.org/src/rev/5399a8f273d9
branches: trunk
changeset: 535509:5399a8f273d9
user: wiz <wiz%NetBSD.org@localhost>
date: Tue Aug 20 16:15:38 2002 +0000
description:
Mark up NULL and ENOMEM.
diffstat:
lib/libc/stdlib/malloc.3 | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
diffs (89 lines):
diff -r 4964f77939f6 -r 5399a8f273d9 lib/libc/stdlib/malloc.3
--- a/lib/libc/stdlib/malloc.3 Tue Aug 20 16:10:01 2002 +0000
+++ b/lib/libc/stdlib/malloc.3 Tue Aug 20 16:15:38 2002 +0000
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
.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 @@
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 ,
Home |
Main Index |
Thread Index |
Old Index