t_free Subroutine for X/Open Transport Interface

Purpose

Free a library structure.

Library

X/Open Transport Interface Library (libxti.a)

Syntax

#include <xti.h>

int t_free (
    void *ptr;
    int struct_type)

Description

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.

Parameters

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:
T_BIND
struct t_bind
T_CALL
struct t_call
T_OPTMGMT
struct t_optmgmt
T_DIS
struct t_discon
T_UNITDATA
struct t_unitdata
T_UDERROR
struct t_uderr
T_INFO
struct t_info

Each of these structures may subsequently be used as a parameter to one or more transport functions.

Valid States

ALL - apart from T_UNINIT.

Return Values

Item Description
0 Successful completion.
-1 t_errno is set to indicate an error.

Error Codes

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).