EssRealloc

Description

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);
ESS_HINST_ThInstance
ESS_SIZE_TSize
ESS_PPVOID_TppBlock

Parameters

hInstanceEssbase API instance handle.
SizeNew size of memory block to reallocate.
ppBlockAddress of pointer to previously allocated memory block, to be updated to point to reallocated memory block.

Return Value

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

Notes

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

EssAlloc()
EssFree()
EssInit()