Go to the first, previous, next, last section, table of contents.


Allocating and Freeing Relocatable Blocks

In the descriptions below, handleptr designates the address of the handle. All the functions are declared in `malloc.h'; all are GNU extensions.

Function: void * r_alloc (void **handleptr, size_t size)
This function allocates a relocatable block of size size. It stores the block's address in *handleptr and returns a non-null pointer to indicate success.

If r_alloc can't get the space needed, it stores a null pointer in *handleptr, and returns a null pointer.

Function: void r_alloc_free (void **handleptr)
This function is the way to free a relocatable block. It frees the block that *handleptr points to, and stores a null pointer in *handleptr to show it doesn't point to an allocated block any more.

Function: void * r_re_alloc (void **handleptr, size_t size)
The function r_re_alloc adjusts the size of the block that *handleptr points to, making it size bytes long. It stores the address of the resized block in *handleptr and returns a non-null pointer to indicate success.

If enough memory is not available, this function returns a null pointer and does not modify *handleptr.


Go to the first, previous, next, last section, table of contents.