]> diplodocus.org Git - nmh/blob - sbr/folder_free.c
mhbuildsbr.c: Flip logic, moving goto to then-block; no need for else.
[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 #include "lock_file.h"
11
12
13 void
14 folder_free (struct msgs *mp)
15 {
16 size_t i;
17 struct bvector *v;
18
19 if (!mp)
20 return;
21
22 mh_xfree(mp->foldpath);
23
24 /* free the sequence names */
25 for (i = 0; i < svector_size (mp->msgattrs); i++)
26 free (svector_at (mp->msgattrs, i));
27 svector_free (mp->msgattrs);
28
29 for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
30 bvector_fini(v);
31 }
32 free (mp->msgstats);
33
34 /* Close/free the sequence file if it is open */
35
36 if (mp->seqhandle)
37 lkfclosedata (mp->seqhandle, mp->seqname);
38
39 mh_xfree(mp->seqname);
40
41 bvector_free (mp->attrstats);
42 free (mp); /* free main folder structure */
43 }