EssRealloc

Reallocates a previously-allocated block of memory to a different size, using the defined memory allocation scheme.

Syntax

ESS_FUNC_M  EssRealloc (hInstance, Size, ppBlock);
ParameterData TypeDescription

hInstance

ESS_HINST_T

API instance handle.

Size

ESS_SIZE_T

New size of memory block to reallocate.

ppBlock

ESS_PPVOID_T

Address of pointer to previously allocated memory block, to be updated to point to reallocated memory block.

Notes

Return Value

If successful, returns a pointer to the reallocated memory block in ppBlock.

Access

This function requires no special privileges.

Example

ESS_VOID_T 
ESS_Realloc (ESS_HINST_T hInst)
{
   ESS_FUNC_M     sts = ESS_STS_NOERR;  
   ESS_SIZE_T    Size;
   ESS_PVOID_T   pBlock = NULL;
   
   /* Allocate memory */
   Size = 10;
   sts = EssAlloc(hInst, Size, &pBlock);   
   if(sts)
      printf("Cannot allocate memory\r\n");
   
   /* Reallocate memory */
   Size = 20;
   if(!sts)
   {
      sts = EssRealloc(hInst, Size, &pBlock);
      if(sts)
         printf("Cannot reallocate memory\r\n");
   }
      
    if(pBlock)
       EssFree(hInst, pBlock);
}

See Also