]> diplodocus.org Git - nmh/blob - sbr/folder_free.c
uip/flist.c: Make locally defined and used functions static.
[nmh] / sbr / folder_free.c
1 /* folder_free.c -- free a folder/message structure
2 *
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
6 */
7
8 #include <h/mh.h>
9 #include <h/utils.h>
10
11
12 void
13 folder_free (struct msgs *mp)
14 {
15 size_t i;
16 struct bvector *v;
17
18 if (!mp)
19 return;
20
21 mh_xfree(mp->foldpath);
22
23 /* free the sequence names */
24 for (i = 0; i < svector_size (mp->msgattrs); i++)
25 free (svector_at (mp->msgattrs, i));
26 svector_free (mp->msgattrs);
27
28 for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
29 bvector_fini(v);
30 }
31 free (mp->msgstats);
32
33 /* Close/free the sequence file if it is open */
34
35 if (mp->seqhandle)
36 lkfclosedata (mp->seqhandle, mp->seqname);
37
38 mh_xfree(mp->seqname);
39
40 bvector_free (mp->attrstats);
41 free (mp); /* free main folder structure */
42 }