]> diplodocus.org Git - nmh/commitdiff
uip/mhcachesbr.c: Move exported symbols to existing h/mhcachesbr.h.
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 15 May 2017 15:09:28 +0000 (16:09 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 15 May 2017 15:09:28 +0000 (16:09 +0100)
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.

h/mhcachesbr.h
uip/mhbuild.c
uip/mhbuildsbr.c
uip/mhcachesbr.c
uip/mhlist.c
uip/mhn.c
uip/mhparse.c
uip/mhshow.c
uip/mhstore.c

index d02c9f1bf00d675c7514fe0cb63580a79b2d8ce5..6e6beacb839c2d5cddcd50c4f72afe9bb057b0a5 100644 (file)
 #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;
index 686941ffafa461d03c0c243dc1ee056ee5839014..efb9c5269608a1c1f734f3eb4112e99475e1fffa 100644 (file)
@@ -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);
index 26f9e3bd5badc74b787705c5a1386bc2c545d712..4de934f5d944b050119bddd7634ca7eaf271efeb 100644 (file)
@@ -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 {
index 2c9a33de5f16416be3dddeae2b77370ca538b916..55a41d5d423276d76fd6d12412ac40eb8482c130 100644 (file)
 #endif
 #include <time.h>
 
+#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
  */
index 0dc142a3470e515f2ab96f421522f96175253d39..1d8020df843dd557ef3ebb5c044af0a79415a593 100644 (file)
@@ -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);
index 335d4b29423241a17c24d070e8783ae75c0ed509..816f8d9f80b1329d8cc3ae2ee687861832b626fb 100644 (file)
--- 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);
index 0be13294926e323b671dfe567033d258a88fa51d..69660a91d3e416525e790f23e363a6b02a1d9587 100644 (file)
@@ -13,6 +13,7 @@
 #include <h/mime.h>
 #include <h/mhparse.h>
 #include <h/utils.h>
+#include <h/mhcachesbr.h>
 #include "../sbr/m_mktemp.h"
 #include "mhfree.h"
 #ifdef HAVE_ICONV
 
 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);
index ce0d8f6a06e2255327376f8a217882170cd8da3c..a294c90ebe008ef9b1ff15618f6d46b27fe21540 100644 (file)
@@ -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);
index 2fce6c8dadd372c997195f69ee78511af9c9a6b9..26db5f227de11ef1a54ebf2b8cc127d8fef9da7c 100644 (file)
@@ -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);