X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/f2753d64be0a74a22018e03ec9c04cc9ca45d3ab..6fd1d18f:/uip/mhstoresbr.c?ds=inline diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index 7d74f1ea..64bddb69 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -10,10 +10,14 @@ #include #include #include +#include #include #include #include -#include "../sbr/m_mktemp.h" +#include "mhmisc.h" +#include "mhshowsbr.h" +#include "sbr/m_maildir.h" +#include "sbr/m_mktemp.h" enum clobber_policy_t { NMH_CLOBBER_ALWAYS = 0, @@ -23,7 +27,7 @@ enum clobber_policy_t { NMH_CLOBBER_NEVER }; -static enum clobber_policy_t clobber_policy (const char *); +static enum clobber_policy_t clobber_policy (const char *) PURE; struct mhstoreinfo { CT *cts; /* Top-level list of contents to store. */ @@ -77,11 +81,6 @@ mhstoreinfo_files_not_clobbered (const mhstoreinfo_t info) { typedef int (*qsort_comp) (const void *, const void *); -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void flush_errors (void); - /* * static prototypes */ @@ -471,7 +470,7 @@ ct_compar (CT *a, CT *b) struct partial *am = (struct partial *) ((*a)->c_ctparams); struct partial *bm = (struct partial *) ((*b)->c_ctparams); - return (am->pm_marked - bm->pm_marked); + return am->pm_marked - bm->pm_marked; } @@ -528,7 +527,7 @@ store_content (CT ct, CT p, mhstoreinfo_t info) if (p) { appending = 1; if (! ct->c_storage) { - ct->c_storage = add (p->c_storage, NULL); + ct->c_storage = mh_xstrdup(FENDNULL(p->c_storage)); /* record the folder name */ if (p->c_folder) { @@ -783,7 +782,7 @@ losing: fclose (fp); - return (cc != NOTOK ? OK : NOTOK); + return cc == NOTOK ? NOTOK : OK; } if (!ct->c_fp && (ct->c_fp = fopen (ct->c_file, "r")) == NULL) { @@ -899,13 +898,12 @@ output_content_folder (char *folder, char *filename) struct msgs *mp; /* Read the folder. */ - if ((mp = folder_read (folder, 0))) { - /* Link file into folder */ - msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0, NULL); - } else { + if (!(mp = folder_read(folder, 0))) { inform("unable to read folder %s", folder); return NOTOK; } + /* Link file into folder */ + msgnum = folder_addmsg(&mp, filename, 0, 0, 0, 0, NULL); /* free folder structure */ folder_free (mp); @@ -1072,7 +1070,7 @@ get_storeproc (CT ct) free(cp); return; } - mh_xfree(cp); + free(cp); } /* @@ -1086,7 +1084,7 @@ get_storeproc (CT ct) ct->c_storeproc = mh_xstrdup(cp); } - mh_xfree(cp); + free(cp); }