diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2019-09-12 23:03:03 +0000 |
---|---|---|
committer | Andy Fiddaman <omnios@citrus-it.co.uk> | 2019-09-16 16:32:55 +0000 |
commit | e7b66456775e45577294dfd79cab910ecb886cf2 (patch) | |
tree | a6b1a182c6ad2ea3b05c306e3edd8d73897dc147 /usr/src/man/man3c/malloc.3c | |
parent | acbbf6c3e48e6820369e27e9bd3724278b5ba825 (diff) | |
download | illumos-joyent-e7b66456775e45577294dfd79cab910ecb886cf2.tar.gz |
11680 want reallocf(3C)
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Matthias Scheler <matthias.scheler@wdc.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/man/man3c/malloc.3c')
-rw-r--r-- | usr/src/man/man3c/malloc.3c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/usr/src/man/man3c/malloc.3c b/usr/src/man/man3c/malloc.3c index 79b7a6f4fa..1fbc0d1775 100644 --- a/usr/src/man/man3c/malloc.3c +++ b/usr/src/man/man3c/malloc.3c @@ -18,8 +18,9 @@ .\" Copyright 1989 AT&T .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2017 Nexenta Systems, Inc. +.\" Copyright 2019 OmniOS Community Edition (OmniOSce) Association. .\" -.Dd July 28, 2017 +.Dd September 12, 2019 .Dt MALLOC 3C .Os .Sh NAME @@ -29,6 +30,7 @@ .Nm freezero , .Nm memalign , .Nm realloc , +.Nm reallocf , .Nm reallocarray , .Nm recallocarray , .Nm valloc , @@ -65,6 +67,11 @@ .Fa "size_t size" .Fc .Ft void * +.Fo reallocf +.Fa "void *ptr" +.Fa "size_t size" +.Fc +.Ft void * .Fo reallocarray .Fa "void *ptr" .Fa "size_t nelem" @@ -107,6 +114,7 @@ is a pointer to a block previously allocated by .Fn malloc , .Fn calloc , .Fn realloc , +.Fn reallocf , .Fn reallocarray , or .Fn recallocarray . @@ -197,6 +205,12 @@ is 0 and is not a null pointer, the space pointed to is freed. .Pp The +.Fn reallocf +function behaves in the same way as +.Fn realloc +except that the passed pointer is freed automatically on failure. +.Pp +The .Fn reallocarray function is similar to .Fn realloc , @@ -259,6 +273,7 @@ If there is no available memory, .Fn malloc , .Fn calloc , .Fn realloc , +.Fn reallocf , .Fn reallocarray , .Fn recallocarray , .Fn memalign , @@ -275,6 +290,16 @@ is called with the block pointed to by .Fa ptr is left intact. +By contrast, when +.Fn reallocf +is called with +.Fa size +> 0 and returns +.Dv NULL , +the block pointed to by +.Fa ptr +will have been freed. +.Pp If .Fa size , .Fa nelem , @@ -288,6 +313,7 @@ If .Fn malloc , .Fn calloc , .Fn realloc , +.Fn reallocf , .Fn reallocarray , or .Fn recallocarray @@ -305,6 +331,7 @@ The .Fn malloc , .Fn calloc , .Fn realloc , +.Fn reallocf , and .Fn reallocarray functions will fail if: @@ -382,6 +409,7 @@ functions are .Pp The .Fn freezero , +.Fn reallocf , .Fn reallocarray , and .Fn recallocarray |