summaryrefslogtreecommitdiff
path: root/src/src/ip.c
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-12-16 22:24:00 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2019-02-10 23:22:50 +0000
commitd7978c0f8af20ff4c3f770589b1bb81568aecff3 (patch)
tree537a4a88135696e72740ad1c4cde4b7c4a1489c7 /src/src/ip.c
parent40ed89b32412fdab2ca147c27fdb856a5623e382 (diff)
Use C99 initialisations for iterators
(cherry picked from commit db3f7b6972f3b003c0413b78afcfbe295ffe0b97)
Diffstat (limited to 'src/src/ip.c')
-rw-r--r--src/src/ip.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/src/ip.c b/src/src/ip.c
index 552f7dc37..ff76b3871 100644
--- a/src/src/ip.c
+++ b/src/src/ip.c
@@ -394,9 +394,8 @@ int
ip_connectedsocket(int type, const uschar * hostname, int portlo, int porthi,
int timeout, host_item * connhost, uschar ** errstr, const blob * fastopen_blob)
{
-int namelen, port;
+int namelen;
host_item shost;
-host_item *h;
int af = 0, fd, fd4 = -1, fd6 = -1;
shost.next = NULL;
@@ -440,7 +439,7 @@ else
/* Try to connect to the server - test each IP till one works */
-for (h = &shost; h; h = h->next)
+for (host_item * h = &shost; h; h = h->next)
{
fd = Ustrchr(h->address, ':') != 0
? fd6 < 0 ? (fd6 = ip_socket(type, af = AF_INET6)) : fd6
@@ -452,7 +451,7 @@ for (h = &shost; h; h = h->next)
goto bad;
}
- for(port = portlo; port <= porthi; port++)
+ for (int port = portlo; port <= porthi; port++)
if (ip_connect(fd, af, h->address, port, timeout, fastopen_blob) == 0)
{
if (fd != fd6) close(fd6);
@@ -835,8 +834,7 @@ return FALSE;
void
dscp_list_to_stream(FILE *stream)
{
-int i;
-for (i=0; i < dscp_table_size; ++i)
+for (int i = 0; i < dscp_table_size; ++i)
fprintf(stream, "%s\n", dscp_table[i].name);
}