From 94759fce86e40abab9d6d98034e18707a87878eb Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 14 Nov 2018 20:22:50 +0000 Subject: [PATCH] tidying --- src/src/acl.c | 3 --- src/src/debug.c | 2 +- src/src/expand.c | 6 +++--- src/src/header.c | 23 ++++++++++------------- src/src/host.c | 16 +++++----------- src/src/log.c | 4 ++-- src/src/parse.c | 4 ++-- src/src/string.c | 2 +- 8 files changed, 24 insertions(+), 36 deletions(-) diff --git a/src/src/acl.c b/src/src/acl.c index 6cce0aae6..14079a655 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -2165,8 +2165,6 @@ Arguments: log_msgptr for error messages format format string ... supplementary arguments - ss ratelimit option name - where ACL_WHERE_xxxx indicating which ACL this is Returns: ERROR */ @@ -3566,7 +3564,6 @@ for (; cb; cb = cb->next) } while (isspace(*s)) s++; - if (logbits == 0) logbits = LOG_MAIN; log_write(0, logbits, "%s", string_printing(s)); } diff --git a/src/src/debug.c b/src/src/debug.c index 4b0765147..6aa2c41cb 100644 --- a/src/src/debug.c +++ b/src/src/debug.c @@ -244,7 +244,7 @@ if (!string_vformat(debug_ptr, Ustrcpy(p, s); } -while(*debug_ptr != 0) debug_ptr++; +while(*debug_ptr) debug_ptr++; /* Output the line if it is complete. If we added any prefix data and there are internal newlines, make sure the prefix is on the continuation lines, diff --git a/src/src/expand.c b/src/src/expand.c index 49e09ecd8..fcf170dc3 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -7272,9 +7272,9 @@ while (*s != 0) case EOP_RFC2047: { uschar buffer[2048]; - const uschar *string = parse_quote_2047(sub, Ustrlen(sub), headers_charset, - buffer, sizeof(buffer), FALSE); - yield = string_cat(yield, string); + yield = string_cat(yield, + parse_quote_2047(sub, Ustrlen(sub), headers_charset, + buffer, sizeof(buffer), FALSE)); continue; } diff --git a/src/src/header.c b/src/src/header.c index decd0cce6..51aa9f953 100644 --- a/src/src/header.c +++ b/src/src/header.c @@ -99,7 +99,7 @@ header_line **hptr; uschar *p, *q; uschar buffer[HEADER_ADD_BUFFER_SIZE]; -if (header_last == NULL) return; +if (!header_last) return; if (!string_vformat(buffer, sizeof(buffer), format, ap)) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "string too long in header_add: " @@ -107,7 +107,7 @@ if (!string_vformat(buffer, sizeof(buffer), format, ap)) /* Find where to insert this header */ -if (name == NULL) +if (!name) { if (after) { @@ -122,7 +122,7 @@ if (name == NULL) received header is allocated and when it is actually filled in. We want that header to be first, so skip it for now. */ - if (header_list->text == NULL) + if (!header_list->text) hptr = &header_list->next; h = *hptr; } @@ -134,15 +134,14 @@ else /* Find the first non-deleted header with the correct name. */ - for (hptr = &header_list; (h = *hptr) != NULL; hptr = &(h->next)) - { - if (header_testname(h, name, len, TRUE)) break; - } + for (hptr = &header_list; (h = *hptr); hptr = &h->next) + if (header_testname(h, name, len, TRUE)) + break; /* Handle the case where no header is found. To insert at the bottom, nothing needs to be done. */ - if (h == NULL) + if (!h) { if (topnot) { @@ -155,14 +154,12 @@ else true. In this case, we want to include deleted headers in the block. */ else if (after) - { for (;;) { - if (h->next == NULL || !header_testname(h, name, len, FALSE)) break; + if (!h->next || !header_testname(h, name, len, FALSE)) break; hptr = &(h->next); h = h->next; } - } } /* Loop for multiple header lines, taking care about continuations. At this @@ -174,7 +171,7 @@ for (p = q = buffer; *p != 0; ) for (;;) { q = Ustrchr(q, '\n'); - if (q == NULL) q = p + Ustrlen(p); + if (!q) q = p + Ustrlen(p); if (*(++q) != ' ' && *q != '\t') break; } @@ -187,7 +184,7 @@ for (p = q = buffer; *p != 0; ) *hptr = new; hptr = &(new->next); - if (h == NULL) header_last = new; + if (!h) header_last = new; p = q; } } diff --git a/src/src/host.c b/src/src/host.c index 0da99334a..208e567a1 100644 --- a/src/src/host.c +++ b/src/src/host.c @@ -1796,7 +1796,7 @@ while ((ordername = string_nextinlist(&list, &sep, buffer, sizeof(buffer)))) /* If we have failed to find a name, return FAIL and log when required. NB host_lookup_msg must be in permanent store. */ -if (sender_host_name == NULL) +if (!sender_host_name) { if (host_checking || !f.log_testing_mode) log_write(L_host_lookup_failed, LOG_MAIN, "no host name found for IP " @@ -1832,15 +1832,9 @@ for (hname = sender_host_name; hname; hname = *aliases++) { int rc; BOOL ok = FALSE; - host_item h; - dnssec_domains d; - - h.next = NULL; - h.name = hname; - h.mx = MX_NONE; - h.address = NULL; - d.request = sender_host_dnssec ? US"*" : NULL;; - d.require = NULL; + host_item h = { .next = NULL, .name = hname, .mx = MX_NONE, .address = NULL }; + dnssec_domains d = + { .request = sender_host_dnssec ? US"*" : NULL, .require = NULL }; if ( (rc = host_find_bydns(&h, NULL, HOST_FIND_BY_A | HOST_FIND_BY_AAAA, NULL, NULL, NULL, &d, NULL, NULL)) == HOST_FOUND @@ -2598,7 +2592,7 @@ f.host_find_failed_syntax = FALSE; assume TCP protocol. DNS domain names are constrained to a maximum of 256 characters, so the code below should be safe. */ -if ((whichrrs & HOST_FIND_BY_SRV) != 0) +if (whichrrs & HOST_FIND_BY_SRV) { uschar buffer[300]; uschar *temp_fully_qualified_name = buffer; diff --git a/src/src/log.c b/src/src/log.c index 2832f4ed0..678c02be7 100644 --- a/src/src/log.c +++ b/src/src/log.c @@ -560,13 +560,13 @@ log_config_info(uschar *ptr, int flags) Ustrcpy(ptr, "Exim configuration error"); ptr += 24; -if ((flags & (LOG_CONFIG_FOR & ~LOG_CONFIG)) != 0) +if (flags & (LOG_CONFIG_FOR & ~LOG_CONFIG)) { Ustrcpy(ptr, " for "); return ptr + 5; } -if ((flags & (LOG_CONFIG_IN & ~LOG_CONFIG)) != 0) +if (flags & (LOG_CONFIG_IN & ~LOG_CONFIG)) ptr += sprintf(CS ptr, " in line %d of %s", config_lineno, config_filename); Ustrcpy(ptr, ":\n "); diff --git a/src/src/parse.c b/src/src/parse.c index 46f9751ab..4b0efa0e1 100644 --- a/src/src/parse.c +++ b/src/src/parse.c @@ -876,7 +876,7 @@ int hlen; BOOL coded = FALSE; BOOL first_byte = FALSE; -if (charset == NULL) charset = US"iso-8859-1"; +if (!charset) charset = US"iso-8859-1"; /* We don't expect this to fail! */ @@ -925,7 +925,7 @@ for (; len > 0; len--) *t++ = '='; *t = 0; -return coded? buffer : string; +return coded ? buffer : string; } diff --git a/src/src/string.c b/src/src/string.c index 3abe2a3bd..112c2adc3 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -701,7 +701,7 @@ return yield; * Format a string and save it * *************************************************/ -/* The formatting is done by string_format, which checks the length of +/* The formatting is done by string_vformat, which checks the length of everything. Arguments: -- 2.25.1