Wed Aug 31 12:17:14 2022 UTC ()
reallocarr(3): Bump date.  Note overflow is handled internally.


(riastradh)
diff -r1.5 -r1.6 src/lib/libc/stdlib/reallocarr.3

cvs diff -r1.5 -r1.6 src/lib/libc/stdlib/reallocarr.3 (expand / switch to unified diff)

--- src/lib/libc/stdlib/reallocarr.3 2022/08/31 12:10:05 1.5
+++ src/lib/libc/stdlib/reallocarr.3 2022/08/31 12:17:14 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: reallocarr.3,v 1.5 2022/08/31 12:10:05 riastradh Exp $ 1.\" $NetBSD: reallocarr.3,v 1.6 2022/08/31 12:17:14 riastradh Exp $
2.\" 2.\"
3.\" Copyright (c) 2015 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2015 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 9.\"
10.\" 1. Redistributions of source code must retain the above copyright 10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer. 11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in 13.\" notice, this list of conditions and the following disclaimer in
14.\" the documentation and/or other materials provided with the 14.\" the documentation and/or other materials provided with the
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16.\" 16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 22.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
23.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.Dd February 19, 2015 29.Dd August 31, 2022
30.Dt REALLOCARR 3 30.Dt REALLOCARR 3
31.Os 31.Os
32.Sh NAME 32.Sh NAME
33.Nm reallocarr 33.Nm reallocarr
34.Nd reallocate array 34.Nd reallocate array
35.Sh SYNOPSIS 35.Sh SYNOPSIS
36.In stdlib.h 36.In stdlib.h
37.Ft int 37.Ft int
38.Fo reallocarr 38.Fo reallocarr
39.Fa "void *ptrp" 39.Fa "void *ptrp"
40.Fa "size_t number" 40.Fa "size_t number"
41.Fa "size_t size" 41.Fa "size_t size"
42.Fc 42.Fc
@@ -90,26 +90,40 @@ must be nonzero. @@ -90,26 +90,40 @@ must be nonzero.
90.Pp 90.Pp
91The memory allocated by 91The memory allocated by
92.Nm 92.Nm
93may be freed with 93may be freed with
94.Fo reallocarr 94.Fo reallocarr
95.Li & Ns Fa ptr , 95.Li & Ns Fa ptr ,
96.Li 0 , 96.Li 0 ,
97.Fa size 97.Fa size
98.Fc , 98.Fc ,
99which will always succeed and unconditionally set 99which will always succeed and unconditionally set
100.Fa ptr 100.Fa ptr
101to null. 101to null.
102.Pp 102.Pp
 103Like
 104.Xr calloc 3 ,
 105.Nm
 106fails gracefully if the product of
 107.Fa number
 108and
 109.Fa size
 110would overflow the representable size of memory.
 111Unlike
 112.Xr calloc 3 ,
 113new memory allocated by
 114.Nm
 115is not zero-initialized.
 116.Pp
103The 117The
104.Nm 118.Nm
105function may alter 119function may alter
106.Va errno 120.Va errno
107as a side effect. 121as a side effect.
108.Pp 122.Pp
109Note that the argument 123Note that the argument
110.Fa ptrp 124.Fa ptrp
111is a pointer to a pointer to allocated memory, unlike 125is a pointer to a pointer to allocated memory, unlike
112.Xr realloc 126.Xr realloc
113which takes a pointer to allocated memory. 127which takes a pointer to allocated memory.
114.Sh RETURN VALUES 128.Sh RETURN VALUES
115On successful completion, 129On successful completion,