From 2c32de2aa313494e065538cf05ab5f66208ecd91 Mon Sep 17 00:00:00 2001 From: Brad House Date: Sat, 18 Jul 2020 10:29:37 -0400 Subject: [PATCH] Ensure c89 support A couple of for loops in Mac-specific code were using integer declarations inside a for loop. Move the declaration to the top of the preceding code block to retain c89 compliance. Reported By: Jeffrey Walton --- ares_init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ares_init.c b/ares_init.c index dffa5181..358ae00b 100644 --- a/ares_init.c +++ b/ares_init.c @@ -1611,7 +1611,8 @@ static int init_by_resolv_conf(ares_channel channel) if (channel->nservers == -1) { union res_sockaddr_union addr[MAXNS]; int nscount = res_getservers(&res, addr, MAXNS); - for (int i = 0; i < nscount; ++i) { + int i; + for (i = 0; i < nscount; ++i) { char str[INET6_ADDRSTRLEN]; int config_status; sa_family_t family = addr[i].sin.sin_family; @@ -1639,8 +1640,9 @@ static int init_by_resolv_conf(ares_channel channel) if (!channel->domains) { status = ARES_ENOMEM; } else { + int i; channel->ndomains = entries; - for (int i = 0; i < channel->ndomains; ++i) { + for (i = 0; i < channel->ndomains; ++i) { channel->domains[i] = ares_strdup(res.dnsrch[i]); if (!channel->domains[i]) status = ARES_ENOMEM;