SOMRealloc

This function changes the size of a previously allocated region of memory.

Syntax
 somToken   ptr; size_t     size; somToken   rc;

rc = (*SOMRealloc)(ptr, size); 

Parameters

 * ptr (somToken) : A pointer to the previously allocated region of memory. If NULL, a new region of memory of size bytes is allocated.

ptr is freed.
 * size (size_t) : The size in bytes for the re-allocated storage. If zero, the memory pointed to by

Return Code

 * rc (somToken) : A pointer to the first byte of the re-allocated space. (A pointer is returned because the block of storage may need to be moved to increase its size.)

Remarks
The SOMRealloc function changes the size of the previously allocated region of memory pointed to by ptr so that it contains size bytes. The new size may be greater or less than the original size. The SOMRealloc function has the same interface as the C realloc function. It performs the same basic function as realloc with some supplemental error checking. If an error occurs, the SOMError function is called. This routine is replaceable by changing the value of the global variable SOMRealloc.

Example Code
 

Functions

 * SOMCalloc
 * SOMMalloc
 * somFree