summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2014-10-30 20:43:36 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2014-10-30 20:43:36 +0000
commit862a82773ece988da646708d832f31285ad019de (patch)
tree582e51c1281375c847ab7bd6ae3cea024cb98cea
parentf43792d6ad303b51f91beb35d6428c66f76024e5 (diff)
Don't mention old systems where realloc(NULL, n) didn't work as we
don't want to give people the idea that this is non-portable (it has been present since C89). OK deraadt@ schwarze@
-rw-r--r--lib/libc/stdlib/malloc.318
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3
index 2647434eaad..8ae3ba20e6d 100644
--- a/lib/libc/stdlib/malloc.3
+++ b/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: malloc.3,v 1.83 2014/10/23 05:48:40 doug Exp $
+.\" $OpenBSD: malloc.3,v 1.84 2014/10/30 20:43:35 millert Exp $
.\"
-.Dd $Mdocdate: October 23 2014 $
+.Dd $Mdocdate: October 30 2014 $
.Dt MALLOC 3
.Os
.Sh NAME
@@ -265,12 +265,13 @@ if ((newp = reallocarray(p, num, size)) == NULL) {
...
.Ed
.Pp
-Code designed for some ancient platforms avoided calling
+Calling
.Fn realloc
with a
.Dv NULL
-.Fa ptr .
-Such hacks are no longer necessary in modern code.
+.Fa ptr
+is equivalent to calling
+.Fn malloc .
Instead of this idiom:
.Bd -literal -offset indent
if (p == NULL)
@@ -279,12 +280,7 @@ else
newp = realloc(p, newsize);
.Ed
.Pp
-Use the following as calling
-.Fn realloc
-with
-.Dv NULL
-is equivalent to calling
-.Fn malloc :
+Use the following:
.Bd -literal -offset indent
newp = realloc(p, newsize);
.Ed