INtime SDK Help
mpool_realloc
INtime SDK v6 > About INtime > Other system libraries > Heaps and memory pools > Memory pools > mpool_realloc

Changes the size of a buffer allocated with mpool_alloc or mpool_realloc.

void * mpool_realloc(
    MPOOL pool, 
    void *  buf, 
    DWORD newlen
);

Parameters

pool
The memory pool created by mpool_create.
buf
The pointer to a buffer created by mpool_alloc or mpool_realloc.
newlen
New length for buf. Must be less than LONG_MAX.

Remarks

If the value of buf is NULL, then mpool_realloc behaves like mpool_alloc. If buf is not NULL and newlen is zero, mpool_realloc returns a NULL pointer and the buffer is deleted. If the new size is smaller than the old size, then some data at the end of the old buffer is discarded. If the new size is larger than the old size, the caller must assume that new space contains uninitialized data. Whenever mpool_realloc returns a pointer different than the buf pointer passed in, the caller must assume that the old pointer is invalid and must not use it any more.

All buffers are returned four byte aligned.

Return Values

A pointer to the new or existing buffer
Success.
NULL
Failure. The function sets errno to one of these values:
E2BIG The size is too large.
ENOSPC Out of virtual memory.
EEXIST The pool is deleted.
EINVAL The pool is not a valid MPOOL.
ENOMEM Out of physical memory.

Requirements

Versions Defined in Include Link to
INtime 4.0 intime/rt/include/mpool.h mpool.h clib.lib
   
See Also