3 * mhfree.c -- routines to free the data structures used to
4 * -- represent MIME messages
12 #include <h/mhparse.h>
19 void free_content (CT);
20 void free_header (CT);
21 void free_ctinfo (CT);
22 void free_encoding (CT, int);
27 static void free_text (CT);
28 static void free_multi (CT);
29 static void free_partial (CT);
30 static void free_external (CT);
34 * Primary routine to free a MIME content structure
44 * free all the header fields
60 * some of the content types have extra
61 * parts which need to be freed.
69 switch (ct->c_subtype) {
74 case MESSAGE_EXTERNAL:
86 free (ct->c_showproc);
88 free (ct->c_termproc);
90 free (ct->c_storeproc);
95 /* free structures for content encodings */
96 free_encoding (ct, 1);
112 free (ct->c_storage);
121 * Free the linked list of header fields
130 hp1 = ct->c_first_hf;
141 ct->c_first_hf = NULL;
142 ct->c_last_hf = NULL;
157 if (ci->ci_subtype) {
158 free (ci->ci_subtype);
159 ci->ci_subtype = NULL;
161 for (ap = ci->ci_attrs; *ap; ap++) {
165 if (ci->ci_comment) {
166 free (ci->ci_comment);
167 ci->ci_comment = NULL;
181 if (!(t = (struct text *) ct->c_ctparams))
185 ct->c_ctparams = NULL;
193 struct part *part, *next;
195 if (!(m = (struct multipart *) ct->c_ctparams))
203 for (part = m->mp_parts; part; part = next) {
204 next = part->mp_next;
205 free_content (part->mp_part);
206 free ((char *) part);
211 ct->c_ctparams = NULL;
220 if (!(p = (struct partial *) ct->c_ctparams))
227 ct->c_ctparams = NULL;
232 free_external (CT ct)
236 if (!(e = (struct exbody *) ct->c_ctparams))
239 free_content (e->eb_content);
244 ct->c_ctparams = NULL;
249 * Free data structures related to encoding/decoding
250 * Content-Transfer-Encodings.
254 free_encoding (CT ct, int toplevel)
258 if (!(ce = ct->c_cefile))
268 unlink (ce->ce_file);
276 ct->c_ceopenfnx = NULL;