[exim-cvs] tidying

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Exim Git Commits Mailing List
Data:  
Para: exim-cvs
Asunto: [exim-cvs] tidying
Gitweb: https://git.exim.org/exim.git/commitdiff/a4a648db4eb00994ae637de2630e43be398a9101
Commit:     a4a648db4eb00994ae637de2630e43be398a9101
Parent:     f078f86ef3e6d0119845cdf8603b8174770cacc7
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Aug 14 11:11:47 2024 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Wed Aug 14 11:17:13 2024 +0100


    tidying
---
 src/src/drtables.c             | 46 +-----------------------------------------
 src/src/globals.h              |  3 +--
 src/src/readconf.c             | 41 ++++---------------------------------
 src/src/route.c                | 41 +++++++++----------------------------
 src/src/routers/accept.c       |  2 +-
 src/src/routers/dnslookup.c    |  2 +-
 src/src/routers/ipliteral.c    |  2 +-
 src/src/routers/iplookup.c     |  2 +-
 src/src/routers/manualroute.c  |  2 +-
 src/src/routers/queryprogram.c |  2 +-
 src/src/routers/redirect.c     |  2 +-
 src/src/transport.c            |  3 ---
 12 files changed, 23 insertions(+), 125 deletions(-)


diff --git a/src/src/drtables.c b/src/src/drtables.c
index 0f64728b4..b51409096 100644
--- a/src/src/drtables.c
+++ b/src/src/drtables.c
@@ -230,31 +230,6 @@ exim binary. */

#include "routers/rf_functions.h"

-/*XXX delete */
-#ifdef ROUTER_DNSLOOKUP
-# include "routers/dnslookup.h"
-#endif
-
-#ifdef ROUTER_MANUALROUTE
-# include "routers/manualroute.h"
-#endif
-
-#ifdef ROUTER_IPLITERAL
-# include "routers/ipliteral.h"
-#endif
-
-#ifdef ROUTER_IPLOOKUP
-# include "routers/iplookup.h"
-#endif
-
-#ifdef ROUTER_QUERYPROGRAM
-# include "routers/queryprogram.h"
-#endif
-
-#ifdef ROUTER_REDIRECT
-# include "routers/redirect.h"
-#endif
-
#ifdef TRANSPORT_APPENDFILE
# include "transports/appendfile.h"
#endif
@@ -280,14 +255,7 @@ exim binary. */
#endif


-router_info * routers_available_newlist = NULL;
-
-/* Now set up the structures, terminated by an entry with a null name. */
-
-router_info routers_available_oldarray[] = {
- { .drinfo = { .driver_name = US"" }}
-};
-
+router_info * routers_available = NULL;


 transport_info * transports_available_newlist = NULL;
@@ -397,8 +365,6 @@ gstring *
 auth_show_supported(gstring * g)
 {
 g = string_cat(g, US"Authenticators:");
-/*XXX these run off the static list as we want them before the conf is read */
-/*XXX Could possibly check for dyn flag + file presence */
 for (auth_info * ai = auths_available_oldarray; ai->drinfo.driver_name[0]; ai++)
            g = string_fmt_append(g, " %s", ai->drinfo.driver_name);
 return string_cat(g, US"\n");
@@ -407,15 +373,6 @@ return string_cat(g, US"\n");
 gstring *
 route_show_supported(gstring * g)
 {
-#ifdef old
-g = string_cat(g, US"Routers:");
-/*XXX these run off the static list as we want them before the conf is read */
-/*XXX lookup_show_supported is in exim.c and just works off the #defines, with hardoded strings */
-for (router_info * rr = routers_available_oldarray; rr->drinfo.driver_name[0]; rr++)
-           g = string_fmt_append(g, " %s", rr->drinfo.driver_name);
-return string_cat(g, US"\n");
-#else
-
 uschar * b = US""        /* static-build router names */
 #if defined(ROUTER_ACCEPT) && ROUTER_ACCEPT!=2
   " accept"
@@ -467,7 +424,6 @@ uschar * d = US""        /* dynamic-module router names */
 if (*b) g = string_fmt_append(g, "Routers (built-in):%s\n", b);
 if (*d) g = string_fmt_append(g, "Routers (dynamic): %s\n", d);
 return g;
-#endif    /*!old*/
 }


 gstring *
diff --git a/src/src/globals.h b/src/src/globals.h
index 817c940ed..6bca06c00 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -947,8 +947,7 @@ extern int     rfc1413_query_timeout;  /* Timeout on RFC 1413 calls */
 /* extern BOOL    rfc821_domains;  */       /* If set, syntax is 821, not 822 => being abolished */
 extern uid_t   root_gid;               /* The gid for root */
 extern uid_t   root_uid;               /* The uid for root */
-extern router_info routers_available_oldarray[];/* Vector of available routers */
-extern router_info *routers_available_newlist;
+extern router_info *routers_available; /* List of available router drivers */
 extern router_instance *routers;       /* Chain of instantiated routers */
 extern router_instance router_defaults;/* Default values */
 extern const uschar *router_name;      /* Name of router last started */
diff --git a/src/src/readconf.c b/src/src/readconf.c
index da94071b5..57788afc3 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -3734,39 +3734,6 @@ static driver_info *
 init_driver(driver_instance * d, driver_info ** info_anchor,
   int size_of_info, const uschar * class)
 {
-/*XXX if dynamic, the _info entry will not be here yet.
-
-For lookups it does it by pulling the info entry out of the dlopen()d
-file (for dynamic) or direct from the lookup .o file (for static).
-It builds a linked-list with those two classes,
-then an array sorted by (? name) and discards the list.
-The array is the _info list.
-
-We'd rather not have to do two passes over the config file(s) section.
-With the number of drivers I see no point in sorting,
-so we could stick with a one-pass build of an _info linked-list.
-This does mean converting any code using the current array.
-
-DONE:
-Rename the array to old.  For now, walk it once and build a linked-list.
-Find and convert all the uses,
-
-Move all the element defns to driver code files.
-Change the init/build to scan them.
-
-Move the scan to the place-of-use reading the config,
-only load if not already on linked-list.
-
-Add the build-dynamic wrapper,
-and scan from dlopen if marked dynamic.
-*/
-
-#ifdef old
-/*XXX walk the old array */
-for (driver_info * di= *info_anchor; di->driver_name[0] != 0;
-     di= (driver_info *)((US di) + size_of_info))
-#endif
-
 driver_info * di;
 int len;
 DIR * dd;
@@ -3822,7 +3789,10 @@ else
     for(driver_magics * dmp = dm; dmp < dm + nelem(dm); dmp++)
       if(Ustrcmp(dmp->class, class) == 0 && dmp->magic == di->dyn_magic)
     {
+    int old_pool = store_pool;
+    store_pool = POOL_PERM;
     add_driver_info(info_anchor, di, size_of_info);
+    store_pool = old_pool;
     DEBUG(D_any) debug_printf("Loaded %s %s\n", d->driver_name, class);
     closedir(dd);
     goto found;
@@ -3898,7 +3868,7 @@ Returns:                     nothing
 void
 readconf_driver_init(
   driver_instance ** anchor,
-  driver_info ** info_anchor,    /*XXX now list not array, static only so far */
+  driver_info ** info_anchor,
   int size_of_info,
   void * instance_default,
   int  instance_size,
@@ -4359,9 +4329,6 @@ auths_init(void)
 int nauths = 0;
 #endif


-/*XXX temp loop just copying the old array to build the new list.
-Will replace with haul from either static build file or dyn module
-done by readconf_driver_init() */
 for (auth_info * tblent = auths_available_oldarray;
     *tblent->drinfo.driver_name; tblent++)
   {
diff --git a/src/src/route.c b/src/src/route.c
index b733d1a52..07f0a6b20 100644
--- a/src/src/route.c
+++ b/src/src/route.c
@@ -159,10 +159,7 @@ uschar buf[64];


options_from_list(optionlist_routers, nelem(optionlist_routers), US"ROUTERS", NULL);

-#ifdef old
-for (router_info * ri = routers_available; ri->drinfo.driver_name[0]; ri++)
-#endif
-for (driver_info * di = (driver_info *)routers_available_newlist; di; di = di->next)
+for (driver_info * di = (driver_info *)routers_available; di; di = di->next)
{
spf(buf, sizeof(buf), US"_DRIVER_ROUTER_%T", di->driver_name);
builtin_macro_create(buf);
@@ -231,29 +228,10 @@ void
route_init(void)
{

-#ifdef old
-/*XXX temp loop just copying the old array to build the new list. */
-for (router_info * tblent = routers_available_oldarray;
-    *tblent->drinfo.driver_name; tblent++)
-  {
-  driver_info * listent = store_get(sizeof(router_info), tblent);
-  memcpy(listent, tblent, sizeof(router_info));
-  listent->next = (driver_info *)routers_available_newlist;
-  routers_available_newlist = (router_info *)listent;
-  }
-#else
-
-/*XXX
-Will replace with ifdeffed explicit calls in drtab.c just building list
-(2 lists?) of names for -bV (DONE),
-plut ifdeffed repeated code here adding static-build modules to list (DONE)
-plus code in readconf.c for dlopen()s just before per-driver init api call.
-*/
-
 int old_pool = store_pool;
 store_pool = POOL_PERM;
   {
-  driver_info ** anchor = (driver_info **) &routers_available_newlist;
+  driver_info ** anchor = (driver_info **) &routers_available;
   extern router_info accept_router_info;
   extern router_info dnslookup_router_info;
   extern router_info ipliteral_router_info;
@@ -262,10 +240,9 @@ store_pool = POOL_PERM;
   extern router_info redirect_router_info;
   extern router_info queryprogram_router_info;


- /*XXX this adds only the statics. We can't get the dynamics as they
- are not linked. Until dlopen(), when we can use dlsym(). So the discovery
- is by the file exitence, via the filename pattern. */
- /*XXX TODO: move the info structs to individual driver files */
+ /* Add the router drivers that are built for static linkage to the
+ list of availables. */
+
#if defined(ROUTER_ACCEPT) && ROUTER_ACCEPT!=2
add_driver_info(anchor, &accept_router_info.drinfo, sizeof(router_info));
#endif
@@ -290,11 +267,13 @@ store_pool = POOL_PERM;
}
store_pool = old_pool;

-#endif /*!old*/

-/*XXX this does the config file "routers" section reading */
+/* Read the config file "routers" section, creating a routers instance list.
+For any yet-undiscovered driver, check for a loadable module and add it to
+those available. */
+
 readconf_driver_init((driver_instance **)&routers,     /* chain anchor */
-  (driver_info **)&routers_available_newlist,   /* available drivers */
+  (driver_info **)&routers_available, /* available drivers */
   sizeof(router_info),                /* size of info blocks */
   &router_defaults,                   /* default values for generic options */
   sizeof(router_instance),            /* size of instance block */
diff --git a/src/src/routers/accept.c b/src/src/routers/accept.c
index 353d1762c..5b247131f 100644
--- a/src/src/routers/accept.c
+++ b/src/src/routers/accept.c
@@ -156,7 +156,7 @@ router_info accept_router_info =
   .options_len =    sizeof(accept_router_options_block),
   .init =        accept_router_init,
 # ifdef DYNLOOKUP
-  .dyn_magic =        ROUTER_MAGIC,           /*XXX*/
+  .dyn_magic =        ROUTER_MAGIC,
 # endif
   },
 .code =        accept_router_entry,
diff --git a/src/src/routers/dnslookup.c b/src/src/routers/dnslookup.c
index 90ea0f613..1520cc376 100644
--- a/src/src/routers/dnslookup.c
+++ b/src/src/routers/dnslookup.c
@@ -492,7 +492,7 @@ router_info dnslookup_router_info =
   .options_len =    sizeof(dnslookup_router_options_block),
   .init =        dnslookup_router_init,
 # ifdef DYNLOOKUP
-  .dyn_magic =        ROUTER_MAGIC,           /*XXX*/
+  .dyn_magic =        ROUTER_MAGIC,
 # endif
   },
 .code =            dnslookup_router_entry,
diff --git a/src/src/routers/ipliteral.c b/src/src/routers/ipliteral.c
index a5ef20d32..54a776e9a 100644
--- a/src/src/routers/ipliteral.c
+++ b/src/src/routers/ipliteral.c
@@ -217,7 +217,7 @@ router_info ipliteral_router_info =
   .options_len =    sizeof(ipliteral_router_options_block),
   .init =        ipliteral_router_init,
 # ifdef DYNLOOKUP
-  .dyn_magic =        ROUTER_MAGIC,           /*XXX*/
+  .dyn_magic =        ROUTER_MAGIC,
 # endif
   },
 .code =            ipliteral_router_entry,
diff --git a/src/src/routers/iplookup.c b/src/src/routers/iplookup.c
index 24362fa88..464112bc0 100644
--- a/src/src/routers/iplookup.c
+++ b/src/src/routers/iplookup.c
@@ -433,7 +433,7 @@ router_info iplookup_router_info =
   .options_len =    sizeof(iplookup_router_options_block),
   .init =        iplookup_router_init,
 # ifdef DYNLOOKUP
-  .dyn_magic =        ROUTER_MAGIC,           /*XXX*/
+  .dyn_magic =        ROUTER_MAGIC,
 # endif
   },
 .code =            iplookup_router_entry,
diff --git a/src/src/routers/manualroute.c b/src/src/routers/manualroute.c
index 095a3af16..c24ae0e2c 100644
--- a/src/src/routers/manualroute.c
+++ b/src/src/routers/manualroute.c
@@ -512,7 +512,7 @@ router_info manualroute_router_info =
   .options_len =    sizeof(manualroute_router_options_block),
   .init =        manualroute_router_init,
 # ifdef DYNLOOKUP
-  .dyn_magic =        ROUTER_MAGIC,           /*XXX*/
+  .dyn_magic =        ROUTER_MAGIC,
 # endif
   },
 .code =            manualroute_router_entry,
diff --git a/src/src/routers/queryprogram.c b/src/src/routers/queryprogram.c
index 606124e7e..943375912 100644
--- a/src/src/routers/queryprogram.c
+++ b/src/src/routers/queryprogram.c
@@ -550,7 +550,7 @@ router_info queryprogram_router_info =
   .options_len =      sizeof(queryprogram_router_options_block),
   .init =             queryprogram_router_init,
 # ifdef DYNLOOKUP
-  .dyn_magic =          ROUTER_MAGIC,           /*XXX*/
+  .dyn_magic =          ROUTER_MAGIC,
 # endif
   },
 .code =               queryprogram_router_entry,
diff --git a/src/src/routers/redirect.c b/src/src/routers/redirect.c
index 50b180372..86278d818 100644
--- a/src/src/routers/redirect.c
+++ b/src/src/routers/redirect.c
@@ -804,7 +804,7 @@ router_info redirect_router_info =
   .options_len =    sizeof(redirect_router_options_block),
   .init =        redirect_router_init,
 # ifdef DYNLOOKUP
-  .dyn_magic =        ROUTER_MAGIC,           /*XXX*/
+  .dyn_magic =        ROUTER_MAGIC,
 # endif
   },
 .code =            redirect_router_entry,
diff --git a/src/src/transport.c b/src/src/transport.c
index 7e47cf1da..e42625ce8 100644
--- a/src/src/transport.c
+++ b/src/src/transport.c
@@ -146,9 +146,6 @@ the work. */
 void
 transport_init(void)
 {
-/*XXX temp loop just copying the old array to build the new list.
-Will replace with haul from either static build file or dyn module
-done by readconf_driver_init() */
 for (transport_info * tblent = transports_available_oldarray;
     *tblent->drinfo.driver_name; tblent++)
   {


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/