From: Jeremy Harris Date: Sun, 30 Dec 2018 18:17:56 +0000 (+0000) Subject: tidying X-Git-Tag: exim-4.93-RC0~307 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=56dbf856f209bbd6c6e211e691b8fd898e01dfe8;p=exim.git tidying (cherry picked from commit 190404d75c168ce1e6dbf6ee08bdbbf62b365e4b) --- diff --git a/src/src/expand.c b/src/src/expand.c index ea10f990d..a39454c1b 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -2170,7 +2170,7 @@ BOOL testfor = TRUE; BOOL tempcond, combined_cond; BOOL *subcondptr; BOOL sub2_honour_dollar = TRUE; -int i, rc, cond_type, roffset; +int rc, cond_type, roffset; int_eximarith_t num[2]; struct stat statbuf; uschar name[256]; @@ -5344,7 +5344,6 @@ while (*s != 0) case EITEM_NHASH: case EITEM_SUBSTR: { - int i; int len; uschar *ret; int val[2] = { 0, -1 }; diff --git a/src/src/receive.c b/src/src/receive.c index 76c2ef0b9..c851d4bd9 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1619,7 +1619,6 @@ not. */ BOOL receive_msg(BOOL extract_recip) { -int i; int rc = FAIL; int msg_size = 0; int process_info_len = Ustrlen(process_info); diff --git a/src/src/rewrite.c b/src/src/rewrite.c index 74342e1d0..6b194ca91 100644 --- a/src/src/rewrite.c +++ b/src/src/rewrite.c @@ -107,11 +107,13 @@ BOOL done = FALSE; int rule_number = 1; int yield_start = 0, yield_end = 0; -if (whole != NULL) *whole = FALSE; +if (whole) *whole = FALSE; /* Scan the rewriting rules */ -for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next) +for (rewrite_rule * rule = rewrite_rules; + rule && !done; + rule_number++, rule = rule->next) { int start, end, pdomain; int count = 0; @@ -121,7 +123,7 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next /* Ensure that the flag matches the flags in the rule. */ - if ((rule->flags & flag) == 0) continue; + if (!(rule->flags & flag)) continue; /* Come back here for a repeat after a successful rewrite. We do this only so many times. */ @@ -134,10 +136,10 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next with the other kinds of rewrite, where expansion happens inside match_address_list(). */ - if ((flag & rewrite_smtp) != 0) + if (flag & rewrite_smtp) { uschar *key = expand_string(rule->key); - if (key == NULL) + if (!key) { if (!f.expand_string_forcedfail) log_write(0, LOG_MAIN|LOG_PANIC, "failed to expand \"%s\" while " @@ -155,7 +157,7 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next else { - if (domain == NULL) domain = Ustrrchr(subject, '@') + 1; + if (!domain) domain = Ustrrchr(subject, '@') + 1; /* Use the general function for matching an address against a list (here just one item, so use the "impossible value" separator UCHAR_MAX+1). */ @@ -198,10 +200,10 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next give up altogether. For other expansion failures we have a configuration error. */ - if (new == NULL) + if (!new) { if (f.expand_string_forcedfail) - { if ((rule->flags & rewrite_quit) != 0) break; else continue; } + { if (rule->flags & rewrite_quit) break; else continue; } expand_string_message = expand_hide_passwords(expand_string_message); @@ -216,7 +218,7 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next newparsed = parse_extract_address(new, &error, &start, &end, &pdomain, flag == rewrite_envfrom || flag == (rewrite_smtp|rewrite_smtp_sender)); - if (newparsed == NULL) + if (!newparsed) { log_write(0, LOG_MAIN|LOG_PANIC, "Rewrite of %s yielded unparseable " "address: %s in address %s", subject, error, new); @@ -230,7 +232,7 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next if (pdomain == 0 && (*newparsed != 0 || (flag != rewrite_envfrom && flag != (rewrite_smtp|rewrite_smtp_sender)))) { - if ((rule->flags & rewrite_qualify) != 0) + if (rule->flags & rewrite_qualify) { newparsed = rewrite_address_qualify(newparsed, TRUE); new = string_sprintf("%.*s%s%.*s", start, new, newparsed, @@ -278,12 +280,12 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next flag set and so we must preserve the non-active portion of the current subject unless the current rule also has the w flag set. */ - if (whole != NULL && (flag & rewrite_all_headers) != 0) + if (whole && (flag & rewrite_all_headers)) { /* Current rule has the w flag set. We must ensure the phrase parts are syntactically valid if they are present. */ - if ((rule->flags & rewrite_whole) != 0) + if (rule->flags & rewrite_whole) { if (start > 0 && new[start-1] == '<') { @@ -349,12 +351,12 @@ for (rewrite_rule * rule = rewrite_rules; rule; rule_number++, rule = rule->next /* If no further rewrites are to be done, set the done flag. This allows repeats of the current rule if configured before breaking the loop. */ - if ((rule->flags & rewrite_quit) != 0) done = TRUE; + if (rule->flags & rewrite_quit) done = TRUE; /* Allow the current rule to be applied up to 10 times if requested. */ - if ((rule->flags & rewrite_repeat) != 0) + if (rule->flags & rewrite_repeat) { if (count++ < 10) goto REPEAT_RULE; log_write(0, LOG_MAIN|LOG_PANIC, "rewrite rule repeat ignored after 10 " diff --git a/src/src/routers/rf_lookup_hostlist.c b/src/src/routers/rf_lookup_hostlist.c index 8faef8d09..7f7ab6d0d 100644 --- a/src/src/routers/rf_lookup_hostlist.c +++ b/src/src/routers/rf_lookup_hostlist.c @@ -230,7 +230,7 @@ for (host_item * prev = NULL, * h = addr->host_list, *next_h; h; h = next_h) DEBUG(D_route) { debug_printf("Removed from host list:\n"); - for (host_item * hh = next_h; h; h = h->next) debug_printf(" %s\n", h->name); + for (; h; h = h->next) debug_printf(" %s\n", h->name); } prev->next = NULL; setflag(addr, af_local_host_removed); diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index 9bd90c77a..8a4dace7e 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -191,6 +191,8 @@ switch (tcp_out_fastopen) tcp_out_fastopen = TFO_NOT_USED; } break; + + default: break; /* compiler quietening */ } # endif } diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index c1cba598c..a63c9abd6 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -2471,7 +2471,6 @@ if ( smtp_peer_options & OPTION_TLS else TLS_NEGOTIATE: { - address_item * addr; uschar * errstr; sx->cctx.tls_ctx = tls_client_start(sx->cctx.sock, sx->conn_args.host, sx->addrlist, sx->conn_args.tblock, @@ -3433,7 +3432,6 @@ smtp_deliver(address_item *addrlist, host_item *host, int host_af, int defport, uschar *interface, transport_instance *tblock, BOOL *message_defer, BOOL suppress_tls) { -address_item *addr; smtp_transport_options_block * ob = SOB tblock->options_block; int yield = OK; int save_errno; @@ -4496,14 +4494,13 @@ int hosts_retry = 0; int hosts_serial = 0; int hosts_total = 0; int total_hosts_tried = 0; -address_item *addr; BOOL expired = TRUE; uschar *expanded_hosts = NULL; uschar *pistring; uschar *tid = string_sprintf("%s transport", tblock->name); smtp_transport_options_block *ob = SOB tblock->options_block; host_item *hostlist = addrlist->host_list; -host_item *host; +host_item *host = NULL; DEBUG(D_transport) {