INtime SDK Help
realloc

Changes the size of a previously allocated memory block or allocates a new one.

#include <stdlib.h>

void *realloc (void *memblock, size_t size);

void *_realloc_internal (void *memblock, size_t size);

Parameters

memblock
Pointer to the beginning of the previously allocated memory block or to a block that has been freed, as long as there has been no intervening call to the corresponding calloc, malloc, or realloc function.
size
New size in bytes.

Remarks

If memblock is a null pointer, realloc functions in the same way as malloc and allocates a new block of size bytes. If memblock is not a null pointer, it should be a pointer returned by calloc, malloc, or a prior call to realloc.

The contents of the block are unchanged up to the shorter of the new and old sizes, although the new block may be in a different location.

The storage space pointed to by the return value is guaranteed to be suitably aligned for storage of any type of object. To get a pointer to a type other than void, use a type cast on the return value.

_realloc_internal behaves identically to realloc, use it to implement your own debug version of realloc.

Return Values

A void pointer to the reallocated (and possibly moved) memory block. The reallocated block is marked in use.
Success.
A null pointer if size is 0 and the memblock argument is not a null pointer, or if there is not enough available memory to expand the block to the given size. In the first case, the original block is freed. In the second, the original block is unchanged.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdlib.h stdlib.h clib.lib

See Also

calloc, free, malloc, C/C++ Runtime heap, Memory pools