X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhfree.c;h=b9f15aa7a1e0c8c7c7404486ce1198bd4157cd85;hp=38b830ec20908eba042b1517d954642ad17bed3a;hb=a485ed478abbd599d8c9aab48934e7a26733ecb1;hpb=f480c03187724e54e5391ee61b810827da319a6c diff --git a/uip/mhfree.c b/uip/mhfree.c index 38b830e..b9f15aa 100644 --- a/uip/mhfree.c +++ b/uip/mhfree.c @@ -1,4 +1,3 @@ - /* * mhfree.c -- routines to free the data structures used to * -- represent MIME messages @@ -41,85 +40,85 @@ static void free_external (CT); void free_content (CT ct) { - if (!ct) - return; - - /* - * free all the header fields - */ - free_header (ct); - - if (ct->c_partno) - free (ct->c_partno); - - if (ct->c_vrsn) - free (ct->c_vrsn); - - if (ct->c_ctline) - free (ct->c_ctline); - - free_ctinfo (ct); - - /* - * some of the content types have extra - * parts which need to be freed. - */ - switch (ct->c_type) { - case CT_MULTIPART: - free_multi (ct); - break; - - case CT_MESSAGE: - switch (ct->c_subtype) { - case MESSAGE_PARTIAL: - free_partial (ct); - break; - - case MESSAGE_EXTERNAL: - free_external (ct); - break; - } - break; - - case CT_TEXT: - free_text (ct); - break; - } - - if (ct->c_showproc) - free (ct->c_showproc); - if (ct->c_termproc) - free (ct->c_termproc); - if (ct->c_storeproc) - free (ct->c_storeproc); - - if (ct->c_celine) - free (ct->c_celine); - - /* free structures for content encodings */ - free_encoding (ct, 1); - - if (ct->c_id) - free (ct->c_id); - if (ct->c_descr) - free (ct->c_descr); - if (ct->c_dispo) - free (ct->c_dispo); - - if (ct->c_file) { - if (ct->c_unlink) - unlink (ct->c_file); - free (ct->c_file); - } - if (ct->c_fp) - fclose (ct->c_fp); - - if (ct->c_storage) - free (ct->c_storage); - if (ct->c_folder) - free (ct->c_folder); - - free (ct); + if (!ct) + return; + + /* + * free all the header fields + */ + free_header (ct); + + if (ct->c_partno) + free (ct->c_partno); + + if (ct->c_vrsn) + free (ct->c_vrsn); + + if (ct->c_ctline) + free (ct->c_ctline); + + free_ctinfo (ct); + + /* + * some of the content types have extra + * parts which need to be freed. + */ + switch (ct->c_type) { + case CT_MULTIPART: + free_multi (ct); + break; + + case CT_MESSAGE: + switch (ct->c_subtype) { + case MESSAGE_PARTIAL: + free_partial (ct); + break; + + case MESSAGE_EXTERNAL: + free_external (ct); + break; + } + break; + + case CT_TEXT: + free_text (ct); + break; + } + + if (ct->c_showproc) + free (ct->c_showproc); + if (ct->c_termproc) + free (ct->c_termproc); + if (ct->c_storeproc) + free (ct->c_storeproc); + + if (ct->c_celine) + free (ct->c_celine); + + /* free structures for content encodings */ + free_encoding (ct, 1); + + if (ct->c_id) + free (ct->c_id); + if (ct->c_descr) + free (ct->c_descr); + if (ct->c_dispo) + free (ct->c_dispo); + + if (ct->c_file) { + if (ct->c_unlink) + unlink (ct->c_file); + free (ct->c_file); + } + if (ct->c_fp) + fclose (ct->c_fp); + + if (ct->c_storage) + free (ct->c_storage); + if (ct->c_folder) + free (ct->c_folder); + + free (ct); } @@ -131,123 +130,123 @@ free_content (CT ct) void free_header (CT ct) { - HF hp1, hp2; + HF hp1, hp2; - hp1 = ct->c_first_hf; - while (hp1) { - hp2 = hp1->next; + hp1 = ct->c_first_hf; + while (hp1) { + hp2 = hp1->next; - free (hp1->name); - free (hp1->value); - free (hp1); + free (hp1->name); + free (hp1->value); + free (hp1); - hp1 = hp2; - } + hp1 = hp2; + } - ct->c_first_hf = NULL; - ct->c_last_hf = NULL; + ct->c_first_hf = NULL; + ct->c_last_hf = NULL; } void free_ctinfo (CT ct) { - char **ap; - CI ci; - - ci = &ct->c_ctinfo; - if (ci->ci_type) { - free (ci->ci_type); - ci->ci_type = NULL; - } - if (ci->ci_subtype) { - free (ci->ci_subtype); - ci->ci_subtype = NULL; - } - for (ap = ci->ci_attrs; *ap; ap++) { - free (*ap); - *ap = NULL; - } - if (ci->ci_comment) { - free (ci->ci_comment); - ci->ci_comment = NULL; - } - if (ci->ci_magic) { - free (ci->ci_magic); - ci->ci_magic = NULL; - } + char **ap; + CI ci; + + ci = &ct->c_ctinfo; + if (ci->ci_type) { + free (ci->ci_type); + ci->ci_type = NULL; + } + if (ci->ci_subtype) { + free (ci->ci_subtype); + ci->ci_subtype = NULL; + } + for (ap = ci->ci_attrs; *ap; ap++) { + free (*ap); + *ap = NULL; + } + if (ci->ci_comment) { + free (ci->ci_comment); + ci->ci_comment = NULL; + } + if (ci->ci_magic) { + free (ci->ci_magic); + ci->ci_magic = NULL; + } } static void free_text (CT ct) { - struct text *t; + struct text *t; - if (!(t = (struct text *) ct->c_ctparams)) - return; + if (!(t = (struct text *) ct->c_ctparams)) + return; - free ((char *) t); - ct->c_ctparams = NULL; + free ((char *) t); + ct->c_ctparams = NULL; } static void free_multi (CT ct) { - struct multipart *m; - struct part *part, *next; - - if (!(m = (struct multipart *) ct->c_ctparams)) - return; - - if (m->mp_start) - free (m->mp_start); - if (m->mp_stop) - free (m->mp_stop); - - for (part = m->mp_parts; part; part = next) { - next = part->mp_next; - free_content (part->mp_part); - free ((char *) part); - } - m->mp_parts = NULL; - - free ((char *) m); - ct->c_ctparams = NULL; + struct multipart *m; + struct part *part, *next; + + if (!(m = (struct multipart *) ct->c_ctparams)) + return; + + if (m->mp_start) + free (m->mp_start); + if (m->mp_stop) + free (m->mp_stop); + + for (part = m->mp_parts; part; part = next) { + next = part->mp_next; + free_content (part->mp_part); + free ((char *) part); + } + m->mp_parts = NULL; + + free ((char *) m); + ct->c_ctparams = NULL; } static void free_partial (CT ct) { - struct partial *p; + struct partial *p; - if (!(p = (struct partial *) ct->c_ctparams)) - return; + if (!(p = (struct partial *) ct->c_ctparams)) + return; - if (p->pm_partid) - free (p->pm_partid); + if (p->pm_partid) + free (p->pm_partid); - free ((char *) p); - ct->c_ctparams = NULL; + free ((char *) p); + ct->c_ctparams = NULL; } static void free_external (CT ct) { - struct exbody *e; + struct exbody *e; - if (!(e = (struct exbody *) ct->c_ctparams)) - return; + if (!(e = (struct exbody *) ct->c_ctparams)) + return; - free_content (e->eb_content); - if (e->eb_body) - free (e->eb_body); + free_content (e->eb_content); + if (e->eb_body) + free (e->eb_body); - free ((char *) e); - ct->c_ctparams = NULL; + free ((char *) e); + ct->c_ctparams = NULL; } @@ -259,40 +258,40 @@ free_external (CT ct) void free_encoding (CT ct, int toplevel) { - CE ce; - - if (!(ce = ct->c_cefile)) - return; - - if (ce->ce_fp) { - fclose (ce->ce_fp); - ce->ce_fp = NULL; - } - - if (ce->ce_file) { - if (ce->ce_unlink) - unlink (ce->ce_file); - free (ce->ce_file); - ce->ce_file = NULL; - } - - if (toplevel) { - free ((char *) ce); - ct->c_cefile = NULL; - } else { - ct->c_ceopenfnx = NULL; - } + CE ce; + + if (!(ce = ct->c_cefile)) + return; + + if (ce->ce_fp) { + fclose (ce->ce_fp); + ce->ce_fp = NULL; + } + + if (ce->ce_file) { + if (ce->ce_unlink) + unlink (ce->ce_file); + free (ce->ce_file); + ce->ce_file = NULL; + } + + if (toplevel) { + free ((char *) ce); + ct->c_cefile = NULL; + } else { + ct->c_ceopenfnx = NULL; + } } void freects_done (int status) { - CT *ctp; + CT *ctp; - if ((ctp = cts)) - for (; *ctp; ctp++) - free_content (*ctp); + if ((ctp = cts)) + for (; *ctp; ctp++) + free_content (*ctp); - exit (status); + exit (status); }