X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/8c513105fde2b8be3397216a0153f9b266fc7dfb..17ba0f52b8df4e6ece849deac1b9d6b88bdc26c6:/src/src/routers/manualroute.c diff --git a/src/src/routers/manualroute.c b/src/src/routers/manualroute.c index e327b7c6f..c9ddd2786 100644 --- a/src/src/routers/manualroute.c +++ b/src/src/routers/manualroute.c @@ -91,30 +91,25 @@ manualroute_router_init(router_instance *rblock) { manualroute_router_options_block *ob = (manualroute_router_options_block *)(rblock->options_block); -int i; /* Host_find_failed must be a recognized word */ -for (i = 0; i < hff_count; i++) - { +for (int i = 0; i < hff_count; i++) if (Ustrcmp(ob->host_find_failed, hff_names[i]) == 0) { ob->hff_code = hff_codes[i]; break; } - } if (ob->hff_code < 0) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n " "unrecognized setting for host_find_failed option", rblock->name); -for (i = 1; i < hff_count; i++) /* NB starts at 1 to skip "ignore" */ - { +for (int i = 1; i < hff_count; i++) /* NB starts at 1 to skip "ignore" */ if (Ustrcmp(ob->host_all_ignored, hff_names[i]) == 0) { ob->hai_code = hff_codes[i]; break; } - } if (ob->hai_code < 0) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n " "unrecognized setting for host_all_ignored option", rblock->name); @@ -300,14 +295,14 @@ else if (!(route_item = rf_expand_data(addr, ob->route_data, &rc))) return rc; (void) parse_route_item(route_item, NULL, &hostlist, &options); - if (hostlist[0] == 0) return DECLINE; + if (!hostlist[0]) return DECLINE; } /* Expand the hostlist item. It may then pointing to an empty string, or to a single host or a list of hosts; options is pointing to the rest of the routelist item, which is either empty or contains various option words. */ -DEBUG(D_route) debug_printf("original list of hosts = \"%s\" options = %s\n", +DEBUG(D_route) debug_printf("original list of hosts = '%s' options = '%s'\n", hostlist, options); newhostlist = expand_string_copy(hostlist); @@ -317,7 +312,7 @@ expand_nmax = -1; /* If the expansion was forced to fail, just decline. Otherwise there is a configuration problem. */ -if (newhostlist == NULL) +if (!newhostlist) { if (f.expand_string_forcedfail) return DECLINE; addr->message = string_sprintf("%s router: failed to expand \"%s\": %s", @@ -326,14 +321,14 @@ if (newhostlist == NULL) } else hostlist = newhostlist; -DEBUG(D_route) debug_printf("expanded list of hosts = \"%s\" options = %s\n", +DEBUG(D_route) debug_printf("expanded list of hosts = '%s' options = '%s'\n", hostlist, options); /* Set default lookup type and scan the options */ lookup_type = LK_DEFAULT; -while (*options != 0) +while (*options) { unsigned n; const uschar *s = options; @@ -380,7 +375,7 @@ while (*options != 0) rc = rf_get_errors_address(addr, rblock, verify, &addr->prop.errors_address); if (rc != OK) return rc; -/* Set up the additional and removeable headers for this address. */ +/* Set up the additional and removable headers for this address. */ rc = rf_get_munge_headers(addr, rblock, &addr->prop.extra_headers, &addr->prop.remove_headers); @@ -403,10 +398,10 @@ single text string that ends up in $host. */ if (transport && transport->info->local) { - if (hostlist[0] != 0) + if (hostlist[0]) { host_item *h; - addr->host_list = h = store_get(sizeof(host_item)); + addr->host_list = h = store_get(sizeof(host_item), FALSE); h->name = string_copy(hostlist); h->address = NULL; h->port = PORT_NONE; @@ -430,7 +425,7 @@ if (transport && transport->info->local) list is mandatory in either case, except when verifying, in which case the address is just accepted. */ -if (hostlist[0] == 0) +if (!hostlist[0]) { if (verify != v_none) goto ROUTED; addr->message = string_sprintf("error in %s router: no host(s) specified " @@ -442,7 +437,7 @@ if (hostlist[0] == 0) /* Otherwise we finish the routing here by building a chain of host items for the list of configured hosts, and then finding their addresses. */ -host_build_hostlist(&(addr->host_list), hostlist, randomize); +host_build_hostlist(&addr->host_list, hostlist, randomize); rc = rf_lookup_hostlist(rblock, addr, rblock->ignore_target_hosts, lookup_type, ob->hff_code, addr_new); if (rc != OK) return rc;