From: Ralph Corderoy Date: Mon, 28 Aug 2017 12:25:53 +0000 (+0100) Subject: Create mhmisc.h with mhmisc.c's global-function prototypes. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/836f8eb0eda25f31b82c07384fc9b1fb60ce7182?hp=e65e51841a9df3df8419fef157f314c41177864f Create mhmisc.h with mhmisc.c's global-function prototypes. Delete the many local copies from each caller. --- diff --git a/Makefile.am b/Makefile.am index caffaabf..9781dfd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -370,6 +370,7 @@ noinst_HEADERS = \ sbr/unquote.h \ thirdparty/jsmn/jsmn.h \ uip/mhfree.h \ + uip/mhmisc.h \ uip/mhoutsbr.h \ uip/mhshowsbr.h \ # diff --git a/h/mhparse.h b/h/mhparse.h index 6b7ebebd..42cab7e4 100644 --- a/h/mhparse.h +++ b/h/mhparse.h @@ -367,16 +367,6 @@ const struct str2init *get_ce_method (const char *) PURE; char *content_charset (CT); void reverse_alternative_parts (CT); -/* - * Given a content structure, return true if the content has a disposition - * of "inline". - * - * Arguments are: - * - * ct - Content structure to examine - */ -int is_inline(CT ct) PURE; - /* * Given a list of messages, display information about them on standard * output. diff --git a/h/prototypes.h b/h/prototypes.h index a0c78060..e62ea065 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -375,7 +375,6 @@ int annotate (char *, char *, char *, bool, bool, int, bool); void annolist(char *, char *, char *, int); void annopreserve(int); void m_pclose(void); -int make_intermediates(char *); int mhl(int, char **); int mhlsbr(int, char **, FILE *(*)(char *)); int distout (char *, char *, char *); diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index bccf33a9..bb68cc5b 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -22,6 +22,7 @@ #include #include #include +#include "mhmisc.h" #include "../sbr/m_mktemp.h" #include "../sbr/message_id.h" #include "../sbr/mime_type.h" @@ -55,9 +56,6 @@ typedef struct convert_list { } convert_list; -/* mhmisc.c */ -void content_error (char *, CT, char *, ...); - /* mhcachesbr.c */ int find_cache (CT, int, int *, char *, char *, int); diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index 0c61fc0f..4c177d18 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -14,6 +14,7 @@ #include #include #include +#include "mhmisc.h" #include "../sbr/lock_file.h" #include "../sbr/m_mktemp.h" @@ -40,13 +41,6 @@ int wcachesw = CACHE_ASK; char *cache_public; char *cache_private; - -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void content_error (char *, CT, char *, ...); -void flush_errors (void); - /* * static prototypes */ diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index fc1b0a6d..d804a663 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -14,6 +14,7 @@ #include "../sbr/m_maildir.h" #include "../sbr/m_mktemp.h" #include "../sbr/mime_type.h" +#include "mhmisc.h" #include "mhfree.h" #include "mhoutsbr.h" #include "mhshowsbr.h" @@ -68,9 +69,6 @@ extern int bogus_mp_content; /* flag from InitMultiPart */ /* flags to/from parse_header_attrs */ extern int suppress_extraneous_trailing_semicolon_warning; -/* mhmisc.c */ -void flush_errors (void); - /* * static prototypes */ diff --git a/uip/mhlist.c b/uip/mhlist.c index 0f9a51ee..9fc42b0f 100644 --- a/uip/mhlist.c +++ b/uip/mhlist.c @@ -15,6 +15,7 @@ #include #include #include +#include "mhmisc.h" #include "../sbr/m_maildir.h" #include "mhfree.h" @@ -73,11 +74,6 @@ int debugsw = 0; /* mhparse.c */ CT parse_mime (char *); -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void flush_errors (void); - /* * static prototypes */ diff --git a/uip/mhlistsbr.c b/uip/mhlistsbr.c index 968229c6..d58d43f9 100644 --- a/uip/mhlistsbr.c +++ b/uip/mhlistsbr.c @@ -13,11 +13,7 @@ #include #include #include - -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void flush_errors (void); +#include "mhmisc.h" /* * static prototypes diff --git a/uip/mhmisc.c b/uip/mhmisc.c index a20c186e..778d8055 100644 --- a/uip/mhmisc.c +++ b/uip/mhmisc.c @@ -10,6 +10,7 @@ #include #include #include "../sbr/makedir.h" +#include "mhmisc.h" extern int debugsw; @@ -26,16 +27,6 @@ int userrs = 0; static char *errs = NULL; -/* - * prototypes - */ -int part_ok (CT) PURE; -int part_exact(CT ct) PURE; -int type_ok (CT, int); -void content_error (char *, CT, char *, ...) CHECK_PRINTF(3, 4); -void flush_errors (void); - - int part_ok (CT ct) { @@ -103,7 +94,7 @@ type_ok (CT ct, int sP) /* - * Returns true if this content is marked as "inline". + * Returns true if the content has a disposition of "inline". * * Technically we should check parent content to see if they have * disposition to use as a default, but we don't right now. Maybe diff --git a/uip/mhmisc.h b/uip/mhmisc.h new file mode 100644 index 00000000..bdf9baa5 --- /dev/null +++ b/uip/mhmisc.h @@ -0,0 +1,14 @@ +/* mhmisc.h -- misc routines to process MIME messages + * + * This code is Copyright (c) 2017, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. + */ + +int part_ok(CT) PURE; +int part_exact(CT) PURE; +int type_ok(CT, int); +int is_inline(CT) PURE; +int make_intermediates(char *); +void content_error(char *, CT, char *, ...) CHECK_PRINTF(3, 4); +void flush_errors(void); diff --git a/uip/mhn.c b/uip/mhn.c index 70da652b..1283a1ab 100644 --- a/uip/mhn.c +++ b/uip/mhn.c @@ -16,6 +16,7 @@ #include #include #include +#include "mhmisc.h" #include "../sbr/m_maildir.h" #include "mhfree.h" #include "mhshowsbr.h" @@ -104,11 +105,6 @@ static int storesw = 0; /* mhparse.c */ CT parse_mime (char *); -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void flush_errors (void); - /* * static prototypes */ diff --git a/uip/mhparse.c b/uip/mhparse.c index 08d22407..b4e97d3d 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -13,6 +13,7 @@ #include #include #include +#include "mhmisc.h" #include #include "../sbr/m_mktemp.h" #include "mhfree.h" @@ -106,11 +107,6 @@ static struct k2v EncodingType[] = { }; -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void content_error (char *, CT, char *, ...); - /* * static prototypes */ diff --git a/uip/mhshow.c b/uip/mhshow.c index 146b8bf2..5cc3b435 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -16,6 +16,7 @@ #include #include #include +#include "mhmisc.h" #include "../sbr/m_maildir.h" #include "../sbr/m_popen.h" #include "mhfree.h" @@ -86,11 +87,6 @@ int verbosw = 0; /* mhparse.c */ CT parse_mime (char *); -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void flush_errors (void); - /* * static prototypes */ diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 99bb4067..c0c3f219 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -15,6 +15,7 @@ #include #include #include +#include "mhmisc.h" #include "mhshowsbr.h" #include "../sbr/m_mktemp.h" #ifdef HAVE_ICONV @@ -40,13 +41,6 @@ char *headerform; int headersw = -1; -/* mhmisc.c */ -int part_ok (CT); -int part_exact (CT); -int type_ok (CT, int); -void content_error (char *, CT, char *, ...); -void flush_errors (void); - /* * static prototypes */ diff --git a/uip/mhstore.c b/uip/mhstore.c index d151df56..850cabe0 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -15,6 +15,7 @@ #include #include #include +#include "mhmisc.h" #include "../sbr/m_maildir.h" #include "mhfree.h" @@ -64,11 +65,6 @@ extern int npreferred; int debugsw = 0; CT parse_mime (char *); -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void flush_errors (void); - /* * static prototypes */ diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index c0398518..46574a13 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -14,6 +14,7 @@ #include #include #include +#include "mhmisc.h" #include "mhshowsbr.h" #include "../sbr/m_maildir.h" #include "../sbr/m_mktemp.h" @@ -80,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 */