diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2018-12-02 01:27:51 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2018-12-02 02:24:52 +0000 |
commit | 8b4556856d2434c8006df5011d4855c07a7ba2b8 (patch) | |
tree | a3f3ce36bd2d43ce57cfb77866c30462076f5296 /src | |
parent | 06f37c802cbe477b2db358a0e76388d2df84691f (diff) |
tidying
Diffstat (limited to 'src')
-rw-r--r-- | src/src/host.c | 30 | ||||
-rw-r--r-- | src/src/routers/manualroute.c | 16 | ||||
-rw-r--r-- | src/src/string.c | 16 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 8 |
4 files changed, 33 insertions, 37 deletions
diff --git a/src/src/host.c b/src/src/host.c index 06cfe338c..29c977fe6 100644 --- a/src/src/host.c +++ b/src/src/host.c @@ -318,12 +318,12 @@ int sep = 0; int fake_mx = MX_NONE; /* This value is actually -1 */ uschar *name; -if (list == NULL) return; +if (!list) return; if (randomize) fake_mx--; /* Start at -2 for randomizing */ *anchor = NULL; -while ((name = string_nextinlist(&list, &sep, NULL, 0)) != NULL) +while ((name = string_nextinlist(&list, &sep, NULL, 0))) { host_item *h; @@ -343,7 +343,7 @@ while ((name = string_nextinlist(&list, &sep, NULL, 0)) != NULL) h->why = hwhy_unknown; h->last_try = 0; - if (*anchor == NULL) + if (!*anchor) { h->next = NULL; *anchor = h; @@ -358,7 +358,7 @@ while ((name = string_nextinlist(&list, &sep, NULL, 0)) != NULL) } else { - while (hh->next != NULL && h->sort_key >= (hh->next)->sort_key) + while (hh->next && h->sort_key >= hh->next->sort_key) hh = hh->next; h->next = hh->next; hh->next = h; @@ -686,23 +686,21 @@ Returns: pointer to a string in big_buffer uschar * host_and_ident(BOOL useflag) { -if (sender_fullhost == NULL) - { - (void)string_format(big_buffer, big_buffer_size, "%s%s", useflag? "U=" : "", - (sender_ident == NULL)? US"unknown" : sender_ident); - } +if (!sender_fullhost) + (void)string_format(big_buffer, big_buffer_size, "%s%s", useflag ? "U=" : "", + sender_ident ? sender_ident : US"unknown"); else { - uschar *flag = useflag? US"H=" : US""; - uschar *iface = US""; - if (LOGGING(incoming_interface) && interface_address != NULL) + uschar * flag = useflag ? US"H=" : US""; + uschar * iface = US""; + if (LOGGING(incoming_interface) && interface_address) iface = string_sprintf(" I=[%s]:%d", interface_address, interface_port); - if (sender_ident == NULL) - (void)string_format(big_buffer, big_buffer_size, "%s%s%s", - flag, sender_fullhost, iface); - else + if (sender_ident) (void)string_format(big_buffer, big_buffer_size, "%s%s%s U=%s", flag, sender_fullhost, iface, sender_ident); + else + (void)string_format(big_buffer, big_buffer_size, "%s%s%s", + flag, sender_fullhost, iface); } return big_buffer; } diff --git a/src/src/routers/manualroute.c b/src/src/routers/manualroute.c index e327b7c6f..301ec80e4 100644 --- a/src/src/routers/manualroute.c +++ b/src/src/routers/manualroute.c @@ -300,14 +300,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 +317,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 +326,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; @@ -403,7 +403,7 @@ 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)); @@ -430,7 +430,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 +442,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; diff --git a/src/src/string.c b/src/src/string.c index 2441f9b17..5e48b445c 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -905,7 +905,7 @@ int sep = *separator; const uschar *s = *listptr; BOOL sep_is_special; -if (s == NULL) return NULL; +if (!s) return NULL; /* This allows for a fixed specified separator to be an iscntrl() character, but at the time of implementation, this is never the case. However, it's best @@ -925,15 +925,13 @@ if (sep <= 0) while (isspace(*s) && *s != sep) s++; } else - { - sep = (sep == 0)? ':' : -sep; - } + sep = sep ? -sep : ':'; *separator = sep; } /* An empty string has no list elements */ -if (*s == 0) return NULL; +if (!*s) return NULL; /* Note whether whether or not the separator is an iscntrl() character. */ @@ -944,13 +942,13 @@ sep_is_special = iscntrl(sep); if (buffer) { int p = 0; - for (; *s != 0; s++) + for (; *s; s++) { if (*s == sep && (*(++s) != sep || sep_is_special)) break; if (p < buflen - 1) buffer[p++] = *s; } while (p > 0 && isspace(buffer[p-1])) p--; - buffer[p] = 0; + buffer[p] = '\0'; } /* Handle the case when a buffer is not provided. */ @@ -980,10 +978,10 @@ else for (;;) { - for (ss = s + 1; *ss != 0 && *ss != sep; ss++) ; + for (ss = s + 1; *ss && *ss != sep; ss++) ; g = string_catn(g, s, ss-s); s = ss; - if (*s == 0 || *(++s) != sep || sep_is_special) break; + if (!*s || *++s != sep || sep_is_special) break; } while (g->ptr > 0 && isspace(g->s[g->ptr-1])) g->ptr--; buffer = string_from_gstring(g); diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 96d694fcc..39d75d3bd 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -4927,10 +4927,10 @@ retry_non_continued: incl_ip, &retry_host_key, &retry_message_key); DEBUG(D_transport) debug_printf("%s [%s]%s retry-status = %s\n", host->name, - (host->address == NULL)? US"" : host->address, pistring, - (host->status == hstatus_usable)? "usable" : - (host->status == hstatus_unusable)? "unusable" : - (host->status == hstatus_unusable_expired)? "unusable (expired)" : "?"); + host->address ? host->address : US"", pistring, + host->status == hstatus_usable ? "usable" + : host->status == hstatus_unusable ? "unusable" + : host->status == hstatus_unusable_expired ? "unusable (expired)" : "?"); /* Skip this address if not usable at this time, noting if it wasn't actually expired, both locally and in the address. */ |