Free a library structure.
X/Open Transport Interface Library (libxti.a)
#include <xti.h>
int t_free (
void *ptr;
int struct_type)
The t_free subroutine frees memory previously allocated by the t_alloc subroutine. This subroutine frees memory for the specified structure and buffers referenced by the structure.
The t_free subroutine checks the addr, opt, and udata fields of the given structure, as appropriate, and frees the buffers pointed to by the buf field of the netbuf structure. If buf is a null pointer, the t_free subroutine does not attempt to free memory. After all buffers are free, the t_free subroutine frees the memory associated with the structure pointed to by the ptr parameter.
Undefined results occur if the ptr parameter or any of the buf pointers points to a block of memory that was not previously allocated by the t_alloc subroutine.
Item | Description |
---|---|
ptr | Points to one of the seven structure types described for the t_alloc subroutine. |
struct_type | Identifies the type of the structure specified by the ptr parameter.
The type can be one of the following:
Each of these structures may subsequently be used as a parameter to one or more transport functions. |
ALL - apart from T_UNINIT.
Item | Description |
---|---|
0 | Successful completion. |
-1 | t_errno is set to indicate an error. |
On failure, t_errno is set to one of the following:
Value | Description |
---|---|
TSYSERR | A system error has occurred during execution of this function. |
TNOSTRUCTYPE | Unsupported struct_type parameter value requested. |
TPROTO | This error indicates that a communication problem has been detected between the X/Open Transport Interface and the transport provider for which there is no other suitable X/Open Transport Interface (t_errno). |