4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
24 /* All Rights Reserved */
27 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
31 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
38 #include <sys/types.h>
42 _tx_free(char *ptr
, int struct_type
, int api_semantics
)
48 struct t_optmgmt
*opt
;
49 struct t_unitdata
*udata
;
50 struct t_uderr
*uderr
;
54 * Free all the buffers associated with the appropriate
55 * fields of each structure.
58 switch (struct_type
) {
61 /* LINTED pointer cast */
62 p
.bind
= (struct t_bind
*)ptr
;
63 if (p
.bind
->addr
.buf
!= NULL
)
64 free(p
.bind
->addr
.buf
);
68 /* LINTED pointer cast */
69 p
.call
= (struct t_call
*)ptr
;
70 if (p
.call
->addr
.buf
!= NULL
)
71 free(p
.call
->addr
.buf
);
72 if (p
.call
->opt
.buf
!= NULL
)
73 free(p
.call
->opt
.buf
);
74 if (p
.call
->udata
.buf
!= NULL
)
75 free(p
.call
->udata
.buf
);
79 /* LINTED pointer cast */
80 p
.opt
= (struct t_optmgmt
*)ptr
;
81 if (p
.opt
->opt
.buf
!= NULL
)
86 /* LINTED pointer cast */
87 p
.dis
= (struct t_discon
*)ptr
;
88 if (p
.dis
->udata
.buf
!= NULL
)
89 free(p
.dis
->udata
.buf
);
93 /* LINTED pointer cast */
94 p
.udata
= (struct t_unitdata
*)ptr
;
95 if (p
.udata
->addr
.buf
!= NULL
)
96 free(p
.udata
->addr
.buf
);
97 if (p
.udata
->opt
.buf
!= NULL
)
98 free(p
.udata
->opt
.buf
);
99 if (p
.udata
->udata
.buf
!= NULL
)
100 free(p
.udata
->udata
.buf
);
104 /* LINTED pointer cast */
105 p
.uderr
= (struct t_uderr
*)ptr
;
106 if (p
.uderr
->addr
.buf
!= NULL
)
107 free(p
.uderr
->addr
.buf
);
108 if (p
.uderr
->opt
.buf
!= NULL
)
109 free(p
.uderr
->opt
.buf
);
116 if (_T_IS_XTI(api_semantics
)) {
117 t_errno
= TNOSTRUCTYPE
;
118 } else { /* TX_TLI_API */