lrt_tpalloc

Buffer Manipulation Functions

Allocates a new buffer.

char *lrt_tpalloc( char *type, char *subtype, long size );

type Buffer type.
subtype Buffer sub-type.
size Size of the buffer.

The lrt_tpalloc function allocates a new buffer and returns a pointer to a buffer of specified type. Since some buffer types require initialization before they can be used, lrt_tpalloc initializes a buffer after it is allocated, before it is returned.

Return Values

If the function is successful, it returns a pointer to a buffer of type type. Otherwise it returns NULL and sets the error code in tperrno.

Parameterization

You cannot use standard parameterization for any arguments in this function.

Example

In the following example, the lrt_tpalloc function allocates a new buffer, data_0. This buffer is an FML buffer with 1024 bytes.

Copy code
/* Allocate a new buffer called data_0*/
data_0 = lrt_tpalloc("FML", "", 1024);