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);
memblock
size
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.
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.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/stdlib.h | stdlib.h | clib.lib |