<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_MemRealloc |
BYTEP FAR PASCAL sx_MemRealloc
(VOIDP vpPtr,
LONG lSize);
Change the size of a memory block allocated with sx_MemAlloc.
Parameters
vpPtr: A pointer to memory that was returned by sx_MemAlloc or sx_MemRealloc.
lSize: The new size of the memory block.
A BYTEP (char far *) to the allocated memory. Always test for a NULL value, which indicates that the reallocation has failed.
cpTextBuffer = (BYTEP) sx_MemAlloc((LONG) MAXMEMO);
if (!cpTextBuffer)
goto sxrexit;
// read the memo
uiMemoLen = GetMemo(wpWorkArea, BASEPTR->lRecNum, lMemoNum,
cpTextBuffer, (USHORT) MAXMEMO);
if (!uiMemoLen)
{
sx_MemDealloc(cpTextBuffer);
goto sxrexit;
}
// reallocate mem back to actual memo size
cpTextBuffer = sx_MemRealloc(cpTextBuffer, (LONG) uiMemoLen + 1);
if (!cpTextBuffer)
goto sxrexit;