From: Ralph Corderoy Date: Mon, 15 May 2017 15:09:28 +0000 (+0100) Subject: uip/mhcachesbr.c: Move exported symbols to existing h/mhcachesbr.h. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a8d183948d18b1fba94a305072bfd3c15f93da03?ds=inline;hp=--cc uip/mhcachesbr.c: Move exported symbols to existing h/mhcachesbr.h. Remove the user's copies of the declarations. A static struct swit caches[] was declared everywhere that included h/mhcachesbr.h. The larger number of includers causes `variable not used' for `caches'. Move that declaration to uip/mhcachesbr.c and have an exported `cache_policy' symbol that points to it for the existing users. --- a8d183948d18b1fba94a305072bfd3c15f93da03 diff --git a/h/mhcachesbr.h b/h/mhcachesbr.h index d02c9f1b..6e6beacb 100644 --- a/h/mhcachesbr.h +++ b/h/mhcachesbr.h @@ -14,7 +14,14 @@ #define X(sw, minchars, id) id, DEFINE_SWITCH_ENUM(CACHE); #undef X +extern struct swit *cache_policy; -#define X(sw, minchars, id) { sw, minchars, id }, -DEFINE_SWITCH_ARRAY(CACHE, caches); -#undef X +void cache_all_messages(CT *cts); +int find_cache(CT ct, int policy, int *writing, char *id, + char *buffer, int buflen); + +extern int rcachesw; +extern int wcachesw; + +extern char *cache_public; +extern char *cache_private; diff --git a/uip/mhbuild.c b/uip/mhbuild.c index 686941ff..efb9c526 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -71,12 +71,6 @@ DEFINE_SWITCH_ENUM(MIMEENCODING); DEFINE_SWITCH_ARRAY(MIMEENCODING, encodingswitches); #undef X -/* mhcachesbr.c */ -extern int rcachesw; -extern int wcachesw; -extern char *cache_public; -extern char *cache_private; - int debugsw = 0; int listsw = 0; @@ -166,9 +160,9 @@ main (int argc, char **argv) do_cache: ; if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); - switch (*icachesw = smatch (cp, caches)) { + switch (*icachesw = smatch (cp, cache_policy)) { case AMBIGSW: - ambigsw (cp, caches); + ambigsw (cp, cache_policy); done (1); case UNKWNSW: adios (NULL, "%s unknown", cp); diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 26f9e3bd..4de934f5 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -36,10 +36,6 @@ extern int listsw; extern int rfc934sw; extern int contentidsw; -/* cache policies */ -extern int rcachesw; /* mhcachesbr.c */ -extern int wcachesw; /* mhcachesbr.c */ - static char prefix[] = "----- =_aaaaaaaaaa"; struct attach_list { diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index 2c9a33de..55a41d5d 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -21,6 +21,11 @@ #endif #include +#define X(sw, minchars, id) { sw, minchars, id }, +DEFINE_SWITCH_ARRAY(CACHE, caches); +#undef X +struct swit *cache_policy = caches; + extern int debugsw; /* cache policies */ @@ -41,12 +46,6 @@ int type_ok (CT, int); void content_error (char *, CT, char *, ...); void flush_errors (void); -/* - * prototypes - */ -void cache_all_messages (CT *); -int find_cache (CT, int, int *, char *, char *, int); - /* * static prototypes */ diff --git a/uip/mhlist.c b/uip/mhlist.c index 0dc142a3..1d8020df 100644 --- a/uip/mhlist.c +++ b/uip/mhlist.c @@ -49,12 +49,6 @@ DEFINE_SWITCH_ARRAY(MHLIST, switches); #undef X -/* mhcachesbr.c */ -extern int rcachesw; -extern int wcachesw; -extern char *cache_public; -extern char *cache_private; - /* mhmisc.c */ extern int npart; extern int ntype; @@ -137,9 +131,9 @@ main (int argc, char **argv) do_cache: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); - switch (*icachesw = smatch (cp, caches)) { + switch (*icachesw = smatch (cp, cache_policy)) { case AMBIGSW: - ambigsw (cp, caches); + ambigsw (cp, cache_policy); done (1); case UNKWNSW: adios (NULL, "%s unknown", cp); diff --git a/uip/mhn.c b/uip/mhn.c index 335d4b29..816f8d9f 100644 --- a/uip/mhn.c +++ b/uip/mhn.c @@ -72,12 +72,6 @@ DEFINE_SWITCH_ARRAY(MHN, switches); #undef X -/* mhcachesbr.c */ -extern int rcachesw; -extern int wcachesw; -extern char *cache_public; -extern char *cache_private; - /* mhshowsbr.c */ extern char *progsw; extern int nolist; @@ -118,9 +112,6 @@ int part_ok (CT); int type_ok (CT, int); void flush_errors (void); -/* mhcachesbr.c */ -void cache_all_messages (CT *); - /* * static prototypes */ @@ -192,9 +183,9 @@ main (int argc, char **argv) do_cache: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); - switch (*icachesw = smatch (cp, caches)) { + switch (*icachesw = smatch (cp, cache_policy)) { case AMBIGSW: - ambigsw (cp, caches); + ambigsw (cp, cache_policy); done (1); case UNKWNSW: adios (NULL, "%s unknown", cp); diff --git a/uip/mhparse.c b/uip/mhparse.c index 0be13294..69660a91 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "../sbr/m_mktemp.h" #include "mhfree.h" #ifdef HAVE_ICONV @@ -22,10 +23,6 @@ extern int debugsw; -/* cache policies */ -extern int rcachesw; /* mhcachesbr.c */ -extern int wcachesw; /* mhcachesbr.c */ - int checksw = 0; /* check Content-MD5 field */ /* @@ -109,9 +106,6 @@ static struct k2v EncodingType[] = { }; -/* mhcachesbr.c */ -int find_cache (CT, int, int *, char *, char *, int); - /* mhmisc.c */ int part_ok (CT); int type_ok (CT, int); diff --git a/uip/mhshow.c b/uip/mhshow.c index ce0d8f6a..a294c90e 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -62,12 +62,6 @@ DEFINE_SWITCH_ARRAY(MHSHOW, switches); #undef X -/* mhcachesbr.c */ -extern int rcachesw; -extern int wcachesw; -extern char *cache_public; -extern char *cache_private; - /* mhshowsbr.c */ extern char *progsw; extern int nomore; /* flags for moreproc/header display */ @@ -156,9 +150,9 @@ main (int argc, char **argv) do_cache: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); - switch (*icachesw = smatch (cp, caches)) { + switch (*icachesw = smatch (cp, cache_policy)) { case AMBIGSW: - ambigsw (cp, caches); + ambigsw (cp, cache_policy); done (1); case UNKWNSW: adios (NULL, "%s unknown", cp); diff --git a/uip/mhstore.c b/uip/mhstore.c index 2fce6c8d..26db5f22 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -45,12 +45,6 @@ DEFINE_SWITCH_ARRAY(MHSTORE, switches); #undef X -/* mhcachesbr.c */ -extern int rcachesw; -extern int wcachesw; -extern char *cache_public; -extern char *cache_private; - /* mhmisc.c */ extern int npart; extern int ntype; @@ -140,9 +134,9 @@ main (int argc, char **argv) do_cache: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); - switch (*icachesw = smatch (cp, caches)) { + switch (*icachesw = smatch (cp, cache_policy)) { case AMBIGSW: - ambigsw (cp, caches); + ambigsw (cp, cache_policy); done (1); case UNKWNSW: adios (NULL, "%s unknown", cp);