.ds Vv 1.2.14 .TH VistaIOMalloc 3 "3 June 1994" "VistaIO Version \*(Vv" .SH NAME VistaIOMalloc, VistaIOCalloc, VistaIORealloc, VistaIOFree \- memory allocation functions .SH SYNOPSIS .nf .ft B VistaIOPointer VistaIOMalloc (size_t \fIsize\fP); .PP .ft B VistaIOPointer VistaIOCalloc (size_t \fInum\fP, size_t \fIelsize\fP); .PP .ft B VistaIOPointer VistaIORealloc (VistaIOPointer \fIptr\fP, size_t \fIsize\fP); .PP .ft B void VistaIOFree (VistaIOPointer \fIptr\fP); .fi .SH ARGUMENTS .IP \fIsize\fP 10n Specifies the number of bytes desired. .IP \fInum\fP Specifies the number of array elements desired. .IP \fIelsize\fP Specifies the size of an array element, in bytes. .IP \fIptr\fP Specifies a pointer to the old storage or to the block of storage that is to be freed. .SH DESCRIPTION The \fBVistaIOMalloc\fP function returns a pointer to a block of storage of at least \fIsize\fP bytes. It returns .SB NULL\c , however, if \fIsize\fP is zero. .PP The \fBVistaIOCalloc\fP function allocates space for \fInum\fP array elements of the size \fIelsize\fP, initializing the space to zero bits. Like \fBVistaIOMalloc\fP, it returns .SB NULL if asked to allocate zero space. .PP The \fBVistaIORealloc\fP function changes a block of storage, pointed to by \fIptr\fP, to be of size \fIsize\fP (possibly moving it). If necessary, it allocates a new block at a different location, copies the old contents (or as much as will fit) into the new block, and then frees the old block. If \fIptr\fP is .SB NULL\c , \fBVistaIORealloc\fP allocates the new storage without copying the old contents; that is, it simply calls \fBVistaIOMalloc\fP. If \fIsize\fP is zero, it frees storage pointed to by \fIptr\fP and returns .SB NULL. .PP The \fBVistaIOFree\fP function frees storage, allowing it to be reused. If \fIptr\fP is .SB NULL\c , \fBVistaIOFree\fP has no effect. .SH "RETURN VALUES" \fBVistaIOMalloc\fP, \fBVistaIOCalloc\fP, and \fBVistaIORealloc\fP each return a pointer to the allocated storage. .PP \fBVistaIOFree\fP does not return a value. .SH "SEE ALSO" .na .nh .BR malloc (3), .BR VistaIONew (3), .BR VistaIONewString (3), .BR VistaIOError (3), .ad .hy .SH DIAGNOSTICS If there is insufficient memory to allocate a requested block, \fBVistaIOMalloc\fP, \fBVistaIOCalloc\fP, or \fBVistaIORealloc\fP will terminate by calling \fBVistaIOError\fP(3) with the message ``Memory allocation failure''. .SH AUTHOR Art Pope Adaption to vistaio: Gert Wollny .SH ACKNOWLEDGMENT These functions and this manual page are based on similar ones included in the X Toolkit Intrinsics, which is Copyright 1985, 1986, 1987, 1988 Massachusetts Institute of Technology, Cambridge, Massachusetts, and Digital Equipment Corporation, Maynard, Massachusetts.