Add EXAMPLES section, from Youri Mouton.
Bump date.
This commit is contained in:
parent
6a0d7a05a0
commit
f95cba75d4
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: reallocarr.3,v 1.2 2015/02/18 08:46:43 wiz Exp $
|
||||
.\" $NetBSD: reallocarr.3,v 1.3 2015/02/19 23:08:21 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -26,7 +26,7 @@
|
||||
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.Dd February 5, 2015
|
||||
.Dd February 19, 2015
|
||||
.Dt REALLOCARR 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -55,6 +55,23 @@ Otherwise, an error code (see
|
||||
is returned and
|
||||
.Fa *ptr
|
||||
and the referenced memory is unmodified.
|
||||
.Sh EXAMPLES
|
||||
The following uses
|
||||
.Fn reallocarr
|
||||
to initialize an array of INITSIZE integers, then
|
||||
resizes it to NEWSIZE elements:
|
||||
.Bd -literal -offset indent
|
||||
int *data = NULL;
|
||||
int ret = 0;
|
||||
|
||||
ret = reallocarr(&data, INITSIZE, sizeof(*data));
|
||||
if (ret)
|
||||
errc(1, ret, "reallocarr failed");
|
||||
|
||||
ret = reallocarr(&data, NEWSIZE, sizeof(*data));
|
||||
if (ret)
|
||||
errc(1, ret, "reallocarr failed on resize");
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr calloc 3
|
||||
.Sh HISTORY
|
||||
|
Loading…
Reference in New Issue
Block a user