Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

realloc(3) Guardian Native C Library Calls Reference Manual
NAME
realloc - Reallocates memory
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <sys/types.h>
#include <stdlib.h>
void realloc(
void pointer,
size_t size);
PARAMETERS
size Species the number of bytes of memory.
pointer Points to the block of memory that was returned by a memory allocation func-
tion.
DESCRIPTION
The realloc() function changes the size of the block of memory pointed to by the pointer param-
eter to the number of bytes specied by the size parameter, and returns a pointer to the block. The
contents of the block remain unchanged up to the lesser of the old and new sizes. If necessary, a
new block is allocated, and data is copied to it. If the pointer parameter is a null pointer, the
realloc() function simply allocates a new block of the requested size. If the size parameter is 0
(zero), the realloc() function frees the specied block in the pointer parameter. If the pointer
parameter is a null pointer and the size parameter is 0 (zero), the function returns a null pointer.
RETURN VALUES
This allocation function returns a pointer to space suitably aligned for storage of any type of
object. Cast the pointer to the type pointer-to-element before using it.
The realloc() function returns a null pointer if there is no available memory or if the memory
area has been corrupted by storing outside the bounds of a block. When this happens, the block
pointed to by the pointer parameter could be destroyed.
ERRORS
If any of the following conditions occurs,the realloc() function sets errno to the corresponding
value:
[ENOMEM] There is not enough storage memory in the system.
RELATED INFORMATION
Functions: calloc(3), free(3), getpagesize(3), malloc(3), valloc(3).
STANDARDS CONFORMANCE
The POSIX standards leave some features to the implementing vendor to dene. In the HP imple-
mentation, the realloc() function returns a null pointer if the size parameter is 0 (zero).
558 Hewlett-Packard Company 527192-007