summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/src/host.c30
-rw-r--r--src/src/routers/manualroute.c16
-rw-r--r--src/src/string.c16
-rw-r--r--src/src/transports/smtp.c8
-rw-r--r--test/stderr/007812
-rw-r--r--test/stderr/00854
-rw-r--r--test/stderr/014916
-rw-r--r--test/stderr/016116
-rw-r--r--test/stderr/018324
-rw-r--r--test/stderr/03884
-rw-r--r--test/stderr/039812
-rw-r--r--test/stderr/52044
12 files changed, 79 insertions, 83 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. */
diff --git a/test/stderr/0078 b/test/stderr/0078
index 550e84f10..a6a99898f 100644
--- a/test/stderr/0078
+++ b/test/stderr/0078
@@ -40,8 +40,8 @@ calling self router
self router called for myhost.test.ex@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
@@ -75,8 +75,8 @@ calling self router
self router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "xx" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'xx' options = 'byname'
set transport remote_smtp
finding IP address for xx
calling host_find_byname
@@ -89,8 +89,8 @@ calling self2 router
self2 router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * myhost.test.ex byname
-original list of hosts = "myhost.test.ex" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = 'myhost.test.ex' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
diff --git a/test/stderr/0085 b/test/stderr/0085
index 1b9995eb9..3e44df439 100644
--- a/test/stderr/0085
+++ b/test/stderr/0085
@@ -81,8 +81,8 @@ smart1 router called for x@smart.domain
domain = smart.domain
route_item = *
smart.domain in "*"? yes (matched "*")
-original list of hosts = "" options =
-expanded list of hosts = "" options =
+original list of hosts = '' options = ''
+expanded list of hosts = '' options = ''
queued for <unset> transport: local_part = x
domain = smart.domain
errors_to=NULL
diff --git a/test/stderr/0149 b/test/stderr/0149
index 87a71b52a..903b3b786 100644
--- a/test/stderr/0149
+++ b/test/stderr/0149
@@ -10,8 +10,8 @@ calling domainlist1 router
domainlist1 router called for x@ten
domain = ten
route_item = ten <+V4NET.0.0.0+V4NET.0.0.1 byname
-original list of hosts = "<+V4NET.0.0.0+V4NET.0.0.1" options = byname
-expanded list of hosts = "<+V4NET.0.0.0+V4NET.0.0.1" options = byname
+original list of hosts = '<+V4NET.0.0.0+V4NET.0.0.1' options = 'byname'
+expanded list of hosts = '<+V4NET.0.0.0+V4NET.0.0.1' options = 'byname'
finding IP address for V4NET.0.0.0
calling host_find_byname
finding IP address for V4NET.0.0.1
@@ -35,8 +35,8 @@ domainlist1 router called for y@two
domain = two
route_item = ten <+V4NET.0.0.0+V4NET.0.0.1 byname
route_item = two V4NET.0.0.2:V4NET.0.0.4 byname
-original list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
-expanded list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
+original list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
+expanded list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
finding IP address for V4NET.0.0.2
calling host_find_byname
finding IP address for V4NET.0.0.4
@@ -136,8 +136,8 @@ domainlist2 router called for x@one
domain = one
route_item = six <+V4NET.0.0.6+V4NET.0.0.7 byname
route_item = one V4NET.0.0.2:V4NET.0.0.4 byname
-original list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
-expanded list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
+original list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
+expanded list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
finding IP address for V4NET.0.0.2
calling host_find_byname
finding IP address for V4NET.0.0.4
@@ -169,8 +169,8 @@ calling domainlist2 router
domainlist2 router called for x@six
domain = six
route_item = six <+V4NET.0.0.6+V4NET.0.0.7 byname
-original list of hosts = "<+V4NET.0.0.6+V4NET.0.0.7" options = byname
-expanded list of hosts = "<+V4NET.0.0.6+V4NET.0.0.7" options = byname
+original list of hosts = '<+V4NET.0.0.6+V4NET.0.0.7' options = 'byname'
+expanded list of hosts = '<+V4NET.0.0.6+V4NET.0.0.7' options = 'byname'
finding IP address for V4NET.0.0.6
calling host_find_byname
finding IP address for V4NET.0.0.7
diff --git a/test/stderr/0161 b/test/stderr/0161
index 6b1f5796b..c8e182322 100644
--- a/test/stderr/0161
+++ b/test/stderr/0161
@@ -55,8 +55,8 @@ calling self router
self router called for myhost.test.ex@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
@@ -100,8 +100,8 @@ calling self router
self router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "xx" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'xx' options = 'byname'
set transport remote_smtp
finding IP address for xx
calling host_find_byname
@@ -114,8 +114,8 @@ calling self2 router
self2 router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * myhost.test.ex byname
-original list of hosts = "myhost.test.ex" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = 'myhost.test.ex' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
@@ -190,8 +190,8 @@ calling fail router
fail router called for fff@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "fff" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'fff' options = 'byname'
set transport remote_smtp
finding IP address for fff
calling host_find_byname
diff --git a/test/stderr/0183 b/test/stderr/0183
index a12a7f462..3f7c7f507 100644
--- a/test/stderr/0183
+++ b/test/stderr/0183
@@ -114,8 +114,8 @@ useryz router called for usery@test.again.dns
domain = test.again.dns
route_item = * $domain bydns
test.again.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.again.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.again.dns' options = 'bydns'
set transport smtp
finding IP address for test.again.dns
doing DNS lookup
@@ -145,8 +145,8 @@ useryz router called for userz@test.again.dns
domain = test.again.dns
route_item = * $domain bydns
test.again.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.again.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.again.dns' options = 'bydns'
finding IP address for test.again.dns
doing DNS lookup
DNS lookup of test.again.dns-A: using cached value DNS_AGAIN
@@ -303,8 +303,8 @@ useryz router called for usery@test.fail.dns
domain = test.fail.dns
route_item = * $domain bydns
test.fail.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.fail.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.fail.dns' options = 'bydns'
set transport smtp
finding IP address for test.fail.dns
doing DNS lookup
@@ -333,8 +333,8 @@ useryz router called for userz@test.fail.dns
domain = test.fail.dns
route_item = * $domain bydns
test.fail.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.fail.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.fail.dns' options = 'bydns'
finding IP address for test.fail.dns
doing DNS lookup
DNS lookup of test.fail.dns-A: using cached value DNS_FAIL
@@ -493,8 +493,8 @@ useryz router called for usery@nonexist.test.ex
domain = nonexist.test.ex
route_item = * $domain bydns
nonexist.test.ex in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "nonexist.test.ex" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'nonexist.test.ex' options = 'bydns'
set transport smtp
finding IP address for nonexist.test.ex
doing DNS lookup
@@ -523,8 +523,8 @@ useryz router called for userz@nonexist.test.ex
domain = nonexist.test.ex
route_item = * $domain bydns
nonexist.test.ex in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "nonexist.test.ex" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'nonexist.test.ex' options = 'bydns'
finding IP address for nonexist.test.ex
doing DNS lookup
DNS lookup of nonexist.test.ex-A: using cached value DNS_NOMATCH
diff --git a/test/stderr/0388 b/test/stderr/0388
index cab89cedf..3b6448d89 100644
--- a/test/stderr/0388
+++ b/test/stderr/0388
@@ -32,8 +32,8 @@ r1 router called for x@y
domain = y
route_item = * "127.0.0.1 : V4NET.0.0.0"
y in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1 : V4NET.0.0.0" options =
-expanded list of hosts = "127.0.0.1 : V4NET.0.0.0" options =
+original list of hosts = '127.0.0.1 : V4NET.0.0.0' options = ''
+expanded list of hosts = '127.0.0.1 : V4NET.0.0.0' options = ''
set transport smtp
finding IP address for 127.0.0.1
calling host_find_byname
diff --git a/test/stderr/0398 b/test/stderr/0398
index 03b126df8..774f38017 100644
--- a/test/stderr/0398
+++ b/test/stderr/0398
@@ -47,8 +47,8 @@ r2 router called for qq@remote
domain = remote
route_item = * 127.0.0.1
remote in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1" options =
-expanded list of hosts = "127.0.0.1" options =
+original list of hosts = '127.0.0.1' options = ''
+expanded list of hosts = '127.0.0.1' options = ''
set transport t2
finding IP address for 127.0.0.1
calling host_find_byname
@@ -96,8 +96,8 @@ r2 router called for qq@remote
domain = remote
route_item = * 127.0.0.1
remote in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1" options =
-expanded list of hosts = "127.0.0.1" options =
+original list of hosts = '127.0.0.1' options = ''
+expanded list of hosts = '127.0.0.1' options = ''
finding IP address for 127.0.0.1
calling host_find_byname
using host_fake_gethostbyname for 127.0.0.1 (IPv4)
@@ -210,8 +210,8 @@ r2 router called for qq@remote
domain = remote
route_item = * 127.0.0.1
remote in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1" options =
-expanded list of hosts = "127.0.0.1" options =
+original list of hosts = '127.0.0.1' options = ''
+expanded list of hosts = '127.0.0.1' options = ''
finding IP address for 127.0.0.1
calling host_find_byname
using host_fake_gethostbyname for 127.0.0.1 (IPv4)
diff --git a/test/stderr/5204 b/test/stderr/5204
index 38f568d23..dd2862b78 100644
--- a/test/stderr/5204
+++ b/test/stderr/5204
@@ -129,8 +129,8 @@ calling s router
s router called for PASS@some.host
domain = some.host
route_item = * 127.0.0.1 byname
-original list of hosts = "127.0.0.1" options = byname
-expanded list of hosts = "127.0.0.1" options = byname
+original list of hosts = '127.0.0.1' options = 'byname'
+expanded list of hosts = '127.0.0.1' options = 'byname'
set transport smtp
finding IP address for 127.0.0.1
calling host_find_byname