t_free(3xti)
Name
t_free − free a library structure
Syntax
#include <xti.h>
int t_free(ptr, struct_type)
char *ptr;
int struct_type;
Arguments
ptr
Points to one of the seven structure types described for t_alloc().
struct_type
Identifies the type of that structure, which must be one of the following:
T_BIND_STRstructt_bind;
T_CALL_STRstructt_call
T_OPTMGMT_STRstructt_optmgmt
T_DIS_STR structt_discon
T_UNITDATA_STRstructt_unitdata
T_UDERROR_STRstructt_uderr
T_INFO_STRstructt_info
Each of these structures is used as an argument to one or more transport functions.
Description
The t_free() function frees memory previously allocated by t_alloc(). This function frees memory for the specified structure and also frees memory for buffers referenced by the structure.
| Parameters | Before Call | After Call |
| ptr | x | / |
| struct_type | x | / |
The t_free() function checks the addr, opt, and udata fields of the given structure (as appropriate) and free the buffers pointed to by the buf field of the netbuf structure. If buf is NULL, t_free() does not attempt to free memory. After all buffers are freed, t_free() frees the memory associated with the structure pointed to by ptr.
Results are undefined if ptr or any of the buf pointers points to a block of memory not previously allocated by t_alloc().
Return Value
Upon successful completion, a value of 0 is returned. On failure, a value of -1 is returned, and t_errno is set to indicate the error.
Diagnostics
On failure, t_errno is set to one of the following:
[TNOTSUPPORT] This function is not supported by the current implementation of XTI.
[TSYSERR] A system error has occurred during execution of this function.
See Also
t_alloc()