1 /*
2 * CDDL HEADER START
3 *
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
7 * with the License.
8 *
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.
13 *
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]
19 *
20 * CDDL HEADER END
21 */
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
24
25
26 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
27 /* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
28
29 #include "stdlib.h"
30
31 #include "lp.h"
32 #include "filters.h"
33
34 /**
35 ** freefilter() - FREE INTERNAL SPACE ALLOCATED FOR A FILTER
36 ** free_filter() - FREE INTERNAL SPACE ALLOCATED FOR A _FILTER
37 **/
38
39 static void
40 #if defined(__STDC__)
freetypel(TYPE * typel)41 freetypel (
42 TYPE * typel
43 )
44 #else
45 freetypel (typel)
46 register TYPE *typel;
47 #endif
48 {
49 register TYPE *pt;
50
51 if (typel) {
52 for (pt = typel; pt->name; pt++)
53 Free (pt->name);
54 Free ((char *)typel);
55 }
56 return;
57 }
58
59 void
60 #if defined(__STDC__)
freetempl(TEMPLATE * templ)61 freetempl (
62 TEMPLATE * templ
63 )
64 #else
65 freetempl (templ)
66 register TEMPLATE *templ;
67 #endif
68 {
69 register TEMPLATE *pt;
70
71 if (templ) {
72 for (pt = templ; pt->keyword; pt++) {
73 Free (pt->keyword);
74 if (pt->pattern)
75 Free (pt->pattern);
76 if (pt->re)
77 Free (pt->re);
78 if (pt->result)
79 Free (pt->result);
80 }
81 Free ((char *)templ);
82 }
83 return;
84 }
85
86 void
87 #if defined(__STDC__)
freefilter(FILTER * pf)88 freefilter (
89 FILTER * pf
90 )
91 #else
92 freefilter (pf)
93 FILTER *pf;
94 #endif
95 {
96 if (!pf)
97 return;
98 if (pf->name)
99 Free (pf->name);
100 if (pf->command)
101 Free (pf->command);
102 freelist (pf->printers);
103 freelist (pf->printer_types);
104 freelist (pf->input_types);
105 freelist (pf->output_types);
106 freelist (pf->templates);
107
108 return;
109 }
110
111 void
112 #if defined(__STDC__)
free_filter(_FILTER * pf)113 free_filter (
114 _FILTER * pf
115 )
116 #else
117 free_filter (pf)
118 _FILTER *pf;
119 #endif
120 {
121 if (!pf)
122 return;
123 if (pf->name)
124 Free (pf->name);
125 if (pf->command)
126 Free (pf->command);
127 freelist (pf->printers);
128 freetypel (pf->printer_types);
129 freetypel (pf->input_types);
130 freetypel (pf->output_types);
131 freetempl (pf->templates);
132
133 return;
134 }
135