summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/malloc.3
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1997-08-23 10:43:26 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1997-08-23 10:43:26 +0000
commit5683ca5ed8afe2eda83ae603d88c3152a11e761c (patch)
tree7bb657f370868e2e8f52bb956bd571d7d7194ec1 /lib/libc/stdlib/malloc.3
parent689079df255df654a8c452248f3b3ca6daf75b6a (diff)
Change realloc(foo,0) to behave like malloc(0). Both now return a pointer
to an object of size zero. This will allow testing on reallocs return value to determine if the operation was successful or not.
Diffstat (limited to 'lib/libc/stdlib/malloc.3')
-rw-r--r--lib/libc/stdlib/malloc.311
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3
index eb09eeedbca..6fd362b93b2 100644
--- a/lib/libc/stdlib/malloc.3
+++ b/lib/libc/stdlib/malloc.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: malloc.3,v 1.6 1997/05/31 08:55:05 tholo Exp $
+.\" $OpenBSD: malloc.3,v 1.7 1997/08/23 10:43:24 pefo Exp $
.\"
.Dd August 27, 1996
.Dt MALLOC 3
@@ -77,6 +77,8 @@ coercion) for storage of any type of object. If the space is of
.Em pagesize
or larger, the memory returned will be page-aligned.
.Pp
+Allocation of a zero size object returns a pointer to a zero size object.
+.Pp
The
.Fn free
function causes the space pointed to by
@@ -120,7 +122,8 @@ If
.Fa size
is zero and
.Fa ptr
-is not a null pointer, the object it points to is freed.
+is not a null pointer, the object it points to is freed and a new zero size
+object is returned.
.Pp
Malloc will first look for a symbolic link called
.Pa /etc/malloc.conf
@@ -211,8 +214,8 @@ function returns no value.
.Pp
The
.Fn realloc
-function returns either a null pointer or a pointer
-to the possibly moved allocated space.
+function a pointer to the possibly moved allocated space;
+otherwise a null pointer is returned.
.Sh MESSAGES
If
.Fn malloc ,