From 9995dd161eda29d2f5213f124e0042ec01a5ab5e Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 13 Aug 2024 09:47:17 +0100 Subject: [PATCH] tidying --- src/src/functions.h | 4 ++-- src/src/readconf.c | 30 ++++++++++++++++-------------- src/src/route.c | 6 +++--- src/src/transport.c | 8 ++++---- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/src/functions.h b/src/src/functions.h index e13f8044e..dbfad63eb 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -423,8 +423,8 @@ extern int rda_interpret(redirect_block *, int, const uschar *, uschar **, error_block **, int *, const uschar *); extern int rda_is_filter(const uschar *); extern BOOL readconf_depends(driver_instance *, uschar *); -extern void readconf_driver_init(uschar *, driver_instance **, - driver_info *, int, void *, int, optionlist *, int); +extern void readconf_driver_init(driver_instance **, driver_info *, int, + void *, int, optionlist *, int, const uschar *); extern const uschar *readconf_find_option(void *); extern void readconf_main(BOOL); extern void readconf_options_from_list(optionlist *, unsigned, const uschar *, uschar *); diff --git a/src/src/readconf.c b/src/src/readconf.c index 231d3feb6..d8f9a53e4 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -3715,10 +3715,11 @@ Returns: pointer to the driver info block */ static driver_info * -init_driver(driver_instance *d, driver_info *drivers_available, - int size_of_info, uschar *class) +init_driver(driver_instance * d, driver_info * drivers_available, + int size_of_info, const uschar * class) { -for (driver_info * dd = drivers_available; dd->driver_name[0] != 0; +/*XXX this is walking the old-array */ +for (driver_info * dd = drivers_available; *dd->driver_name; dd = (driver_info *)((US dd) + size_of_info)) if (Ustrcmp(d->driver_name, dd->driver_name) == 0) { @@ -3726,7 +3727,7 @@ for (driver_info * dd = drivers_available; dd->driver_name[0] != 0; d->info = dd; d->options_block = store_get_perm(len, GET_UNTAINTED); memcpy(d->options_block, dd->options_block, len); - for (int i = 0; i < *(dd->options_count); i++) + for (int i = 0; i < *dd->options_count; i++) dd->options[i].type &= ~opt_set; return dd; } @@ -3767,7 +3768,6 @@ driver_instance must map the first portions of all the _info and _instance blocks for this shared code to work. Arguments: - class "router", "transport", or "authenticator" anchor &routers, &transports, &auths drivers_available available drivers size_of_info size of each info block @@ -3775,20 +3775,22 @@ Arguments: instance_size size of instance block driver_optionlist generic option list driver_optionlist_count count of generic option list + class "router", "transport", or "authenticator" + for error message Returns: nothing */ void readconf_driver_init( - uschar *class, - driver_instance **anchor, - driver_info *drivers_available, + driver_instance ** anchor, + driver_info * drivers_available, int size_of_info, - void *instance_default, + void * instance_default, int instance_size, - optionlist *driver_optionlist, - int driver_optionlist_count) + optionlist * driver_optionlist, + int driver_optionlist_count, + const uschar * class) { driver_instance ** p = anchor; driver_instance * d = NULL; @@ -4243,14 +4245,14 @@ auths_init(void) int nauths = 0; #endif -readconf_driver_init(US"authenticator", - (driver_instance **)(&auths), /* chain anchor */ +readconf_driver_init((driver_instance **)&auths, /* chain anchor */ (driver_info *)auths_available, /* available drivers */ sizeof(auth_info), /* size of info block */ &auth_defaults, /* default values for generic options */ sizeof(auth_instance), /* size of instance block */ optionlist_auths, /* generic options */ - optionlist_auths_size); + optionlist_auths_size, + US"authenticator"); for (auth_instance * au = auths; au; au = au->drinst.next) { diff --git a/src/src/route.c b/src/src/route.c index b20e1ca0b..0c7de556d 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -227,14 +227,14 @@ function. */ void route_init(void) { -readconf_driver_init(US"router", - (driver_instance **)(&routers), /* chain anchor */ +readconf_driver_init((driver_instance **)&routers, /* chain anchor */ (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 */ optionlist_routers, /* generic options */ - optionlist_routers_size); + optionlist_routers_size, + US"router"); for (router_instance * r = routers; r; r = r->drinst.next) { diff --git a/src/src/transport.c b/src/src/transport.c index 3889a8529..febe7c117 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -145,14 +145,14 @@ the work. */ void transport_init(void) { -readconf_driver_init(US"transport", - (driver_instance **)(&transports), /* chain anchor */ +readconf_driver_init((driver_instance **)&transports, /* chain anchor */ (driver_info *)transports_available, /* available drivers */ sizeof(transport_info), /* size of info block */ - &transport_defaults, /* default values for generic options */ + &transport_defaults, /* default values for generic options*/ sizeof(transport_instance), /* size of instance block */ optionlist_transports, /* generic options */ - optionlist_transports_size); + optionlist_transports_size, + US"transport"); /* Now scan the configured transports and check inconsistencies. A shadow transport is permitted only for local transports. */ -- 2.30.2