Synopsis

PDX_MSGT mda_Realloc(long option, void *ent, void *old_ptr, size_t size, void *ptr)

Purpose

Database memory reallocator.

Description

Reallocates a block of memory to a new size. The block of memory may be moved (and the lesser of the old size and the new size copied). The block must have been allocated with mda_Malloc, mda_Calloc, mda_Realloc, or mda_Strdup. Blocks allocated with mda_MallocArray, mda_ReallocArray, or mda_CallocArray must be reallocated using mda_ReallocArray.

If the memory has been associated with an entity (i.e. either the ent argument was not NULL when the memory was originally allocated or mda_AddMemory has been called), then the entity which owns the memory must be passed in ent. If the memory has not been associated, ent must be specified as NULL.

Input

option

Options (not used)

ent

The entity which owns the allocated memory or NULL

old_ptr

The previously allocated block of memory

size

The number of bytes to reallocate

ptr

Address to store the new pointer at

Output

ptr

The allocated memory

Return

MDA error code