]> granicus.if.org Git - libevent/commitdiff
test: make regress_dns C89 compatible
authorLeo Zhang <nguzcf@gmail.com>
Tue, 15 May 2018 04:14:05 +0000 (12:14 +0800)
committerAzat Khuzhin <azat@libevent.org>
Sat, 2 Feb 2019 12:17:57 +0000 (15:17 +0300)
Closes: #635 (cherry-picked)
(cherry picked from commit d9ffd2213702bc22c467bd83c230a1a5e97e9e67)

test/regress_dns.c

index 17cd7099ca71a09ae56978edfa646d85684ad489..579963d2a861c9a3b27159980b3fbb383268adbf 100644 (file)
@@ -1211,6 +1211,7 @@ test_bufferevent_connect_hostname(void *arg)
        int emfile = data->setup_data && !strcmp(data->setup_data, "emfile");
        int success = BEV_EVENT_CONNECTED;
        int default_error = 0;
+       unsigned i;
 
        if (emfile) {
                success = BEV_EVENT_ERROR;
@@ -1257,7 +1258,7 @@ test_bufferevent_connect_hostname(void *arg)
        /* Now, finally, at long last, launch the bufferevents.  One should do
         * a failing lookup IP, one should do a successful lookup by IP,
         * and one should do a successful lookup by hostname. */
-       for (int i = 0; i < ARRAY_SIZE(be); ++i) {
+       for (i = 0; i < ARRAY_SIZE(be); ++i) {
                memset(&be_outcome[i], 0, sizeof(be_outcome[i]));
                be[i] = bufferevent_socket_new(data->base, -1, BEV_OPT_CLOSE_ON_FREE);
                bufferevent_setcb(be[i], NULL, NULL, be_connect_hostname_event_cb,
@@ -1322,7 +1323,7 @@ end:
                evdns_close_server_port(port);
        if (dns)
                evdns_base_free(dns, 0);
-       for (int i = 0; i < ARRAY_SIZE(be); ++i) {
+       for (i = 0; i < ARRAY_SIZE(be); ++i) {
                if (be[i])
                        bufferevent_free(be[i]);
        }