]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests/libtest: follow our code style guidelines better
authorDaniel Stenberg <daniel@haxx.se>
Sun, 3 Apr 2016 09:57:34 +0000 (11:57 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 3 Apr 2016 09:57:34 +0000 (11:57 +0200)
... checksrc of all test code is pending.

71 files changed:
tests/libtest/chkhostname.c
tests/libtest/lib1500.c
tests/libtest/lib1501.c
tests/libtest/lib1506.c
tests/libtest/lib1507.c
tests/libtest/lib1510.c
tests/libtest/lib1512.c
tests/libtest/lib1515.c
tests/libtest/lib1525.c
tests/libtest/lib1526.c
tests/libtest/lib1527.c
tests/libtest/lib1528.c
tests/libtest/lib1531.c
tests/libtest/lib1900.c
tests/libtest/lib500.c
tests/libtest/lib501.c
tests/libtest/lib504.c
tests/libtest/lib505.c
tests/libtest/lib506.c
tests/libtest/lib508.c
tests/libtest/lib509.c
tests/libtest/lib510.c
tests/libtest/lib511.c
tests/libtest/lib513.c
tests/libtest/lib514.c
tests/libtest/lib515.c
tests/libtest/lib516.c
tests/libtest/lib518.c
tests/libtest/lib519.c
tests/libtest/lib520.c
tests/libtest/lib521.c
tests/libtest/lib523.c
tests/libtest/lib524.c
tests/libtest/lib525.c
tests/libtest/lib537.c
tests/libtest/lib539.c
tests/libtest/lib540.c
tests/libtest/lib541.c
tests/libtest/lib542.c
tests/libtest/lib543.c
tests/libtest/lib544.c
tests/libtest/lib547.c
tests/libtest/lib549.c
tests/libtest/lib552.c
tests/libtest/lib553.c
tests/libtest/lib554.c
tests/libtest/lib555.c
tests/libtest/lib556.c
tests/libtest/lib558.c
tests/libtest/lib562.c
tests/libtest/lib566.c
tests/libtest/lib567.c
tests/libtest/lib568.c
tests/libtest/lib569.c
tests/libtest/lib570.c
tests/libtest/lib571.c
tests/libtest/lib572.c
tests/libtest/lib573.c
tests/libtest/lib574.c
tests/libtest/lib576.c
tests/libtest/lib578.c
tests/libtest/lib579.c
tests/libtest/lib582.c
tests/libtest/lib586.c
tests/libtest/lib590.c
tests/libtest/lib597.c
tests/libtest/lib598.c
tests/libtest/lib599.c
tests/libtest/libauthretry.c
tests/libtest/libntlmconnect.c
tests/libtest/test.h

index 02a4eefaa468a79958a644585bf5ba2574034b42..79e382b38c219c1fb7a4a75d7b2fe83a27efab92 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
 int main(int argc, char *argv[])
 {
   char buff[HOSTNAME_MAX];
-  if (argc != 2) {
+  if(argc != 2) {
     printf("Usage: %s EXPECTED_HOSTNAME\n", argv[0]);
     return 1;
   }
 
-  if (Curl_gethostname(buff, HOSTNAME_MAX)) {
+  if(Curl_gethostname(buff, HOSTNAME_MAX)) {
     printf("Curl_gethostname() failed\n");
     return 1;
   }
index 89983613d79fb710122e3d187cec6139fcb19633..f3c49586995386f587b05e8b1cdd45492704166c 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -56,7 +56,7 @@ int test(char *URL)
   while(still_running) {
     int num;
     res = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
-    if (res != CURLM_OK) {
+    if(res != CURLM_OK) {
       printf("curl_multi_wait() returned %d\n", res);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
index f9bd9663b3cfcae658b1b0be92ebd9a75a130382..cc442b5292960e6f282357a63a0b6efca35d6a17 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -41,7 +41,7 @@ static int elapsed(struct timeval *before,
 
   result = (after->tv_sec - before->tv_sec) * 1000000 +
     after->tv_usec - before->tv_usec;
-  if (result < 0)
+  if(result < 0)
     result = 0;
 
   return curlx_sztosi(result);
index 9e03e63f00642a363806d37c43c17b95786368f7..47fc335ce0fd1afca4969c1ad8909d513ad3b9c8 100644 (file)
@@ -46,7 +46,8 @@ int test(char *URL)
 
   /* Create fake DNS entries for serverX.example.com for all handles */
   for(i=0; i < NUM_HANDLES; i++) {
-    snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1, port, address);
+    snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
+             i + 1, port, address);
     printf("%s\n", dnsentry);
     slist2 = curl_slist_append(slist, dnsentry);
     if(!slist2) {
index 5340c57a900bcd3505505a614d7518f6801fa2c4..5a7994ebda987ad083d3fd3963de9fff4ed545a1 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -137,7 +137,7 @@ int test(char *URL)
 
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
-    if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
+    if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
       fprintf(stderr, "ABORTING TEST, since it seems "
               "that it would have run forever.\n");
       break;
index d28bef39a414fa1ebc5791ab84233c7ee2bbdafa..25e9fed3189d78abc63336316ce905cb1f7f7f63 100644 (file)
@@ -44,7 +44,8 @@ int test(char *URL)
 
   /* Create fake DNS entries for serverX.example.com for all handles */
   for(i=0; i < NUM_URLS; i++) {
-    snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1, port, address);
+    snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
+             port, address);
     printf("%s\n", dnsentry);
     slist2 = curl_slist_append(slist, dnsentry);
     if(!slist2) {
index bf03e1a4f708343e7e9a87aa820c0e84c3729a4c..f4091b45a36dff9ceda0155c6c56373c2012d161 100644 (file)
@@ -49,7 +49,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s", port, address);
+  snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
+           port, address);
   printf("%s\n", dnsentry);
   slist = curl_slist_append(slist, dnsentry);
 
index db0d09ed659005c772c0d120b76b1ec749304869..2fd19bb7b5934399d9e13fddf737b8e2c7fa5d59 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -39,7 +39,8 @@
 #define sleep(s) Sleep(s * 1000)
 #endif
 
-static int debug_callback(CURL *curl, curl_infotype info, char *msg, size_t len, void *ptr)
+static int debug_callback(CURL *curl, curl_infotype info, char *msg,
+                          size_t len, void *ptr)
 {
   (void)curl;
   (void)ptr;
@@ -121,7 +122,8 @@ int test(char *URL)
   int i;
   int count = 2;
 
-  snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s", port, address);
+  snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
+           port, address);
 
   start_test_timing();
 
@@ -130,7 +132,8 @@ int test(char *URL)
 
   for(i = 1; i <= count; i++) {
     char target_url[256];
-    snprintf(target_url, sizeof(target_url), "http://testserver.example.com:%s/%s%04d", port, path, i);
+    snprintf(target_url, sizeof(target_url),
+             "http://testserver.example.com:%s/%s%04d", port, path, i);
 
     /* second request must succeed like the first one */
     if((res = do_one_request(multi, target_url, dns_entry)))
index 270a002b563f307cd25505288f89a4a7bd9f618a..c58ebeda94d509e536b1603001a13dae3206eeb0 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  * Copyright (C) 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al.
  *
  * This software is licensed as described in the file COPYING, which
@@ -35,7 +35,7 @@ static char data [] = "Hello Cloud!\n";
 static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 {
   size_t  amount = nmemb * size; /* Total bytes curl wants */
-  if (amount < strlen(data)) {
+  if(amount < strlen(data)) {
     return strlen(data);
   }
   (void)stream;
@@ -64,7 +64,7 @@ int test(char *URL)
 
   hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
 
-  if (!hhl) {
+  if(!hhl) {
     goto test_cleanup;
   }
 
index 0ebd8edad78f2c29591088dcaad2b4ac6e859516..ef66a484da5a7bee4e9db2eb9267435f019ac61a 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al.
+ * Copyright (C) 1998 - 2016, Vijay Panghal, <vpanghal@maginatics.com>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -34,7 +34,7 @@ static char data [] = "Hello Cloud!\n";
 static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 {
   size_t  amount = nmemb * size; /* Total bytes curl wants */
-  if (amount < strlen(data)) {
+  if(amount < strlen(data)) {
     return strlen(data);
   }
   (void)stream;
@@ -62,11 +62,11 @@ int test(char *URL)
 
   hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
   phl = curl_slist_append(phl, "User-Agent: Proxy Agent");
-  if (!hhl || !phl) {
+  if(!hhl || !phl) {
     goto test_cleanup;
   }
   tmp = curl_slist_append(phl, "Expect:");
-  if (!tmp) {
+  if(!tmp) {
     goto test_cleanup;
   }
   phl = tmp;
index e3ba106130b072ad4546fe99098322184eb44c8e..f008cf1e43b53d98dbd612dbd140f0082ac85a67 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al.
+ * Copyright (C) 1998 - 2016, Vijay Panghal, <vpanghal@maginatics.com>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -34,7 +34,7 @@ static char data [] = "Hello Cloud!\n";
 static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 {
   size_t  amount = nmemb * size; /* Total bytes curl wants */
-  if (amount < strlen(data)) {
+  if(amount < strlen(data)) {
     return strlen(data);
   }
   (void)stream;
@@ -62,11 +62,11 @@ int test(char *URL)
   }
 
   hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
-  if (!hhl) {
+  if(!hhl) {
     goto test_cleanup;
   }
   tmp = curl_slist_append(hhl, "Expect: 100-continue");
-  if (!tmp) {
+  if(!tmp) {
     goto test_cleanup;
   }
   hhl = tmp;
index cd953d6f55f10d1e66fbb4a77826b354b69c771f..09af481f43d1aebd2cd5102321a0e7b145d3f9ca 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -46,7 +46,7 @@ int test(char *URL)
   hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
   phl = curl_slist_append(phl, "Proxy-User-Agent: Http Agent2");
 
-  if (!hhl) {
+  if(!hhl) {
     goto test_cleanup;
   }
 
index 438408dfb31842dbba88d767cfe45eed52846c17..b21d06733dab2590e21000f8830df2ef948ae79c 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -49,7 +49,8 @@ int test(char *URL)
 
   /* set the options (I left out a few, you'll get the point anyway) */
   curl_easy_setopt(easy, CURLOPT_URL, URL);
-  curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)testDataSize);
+  curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE,
+                   (curl_off_t)testDataSize);
   curl_easy_setopt(easy, CURLOPT_POSTFIELDS, testData);
 
   /* we start some action by calling perform right away */
@@ -87,8 +88,7 @@ int test(char *URL)
     /* get file descriptors from the transfers */
     mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
-    if(mc != CURLM_OK)
-    {
+    if(mc != CURLM_OK) {
       fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
       break;
     }
@@ -127,8 +127,8 @@ int test(char *URL)
   } while(still_running);
 
   /* See how the transfers went */
-  while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
-    if (msg->msg == CURLMSG_DONE) {
+  while((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
+    if(msg->msg == CURLMSG_DONE) {
       printf("HTTP transfer completed with status %d\n", msg->data.result);
       break;
     }
index 0c6328483bccec4a282fd2ce60848c358acd8c6b..4502fc0d668efaf436df31b9430f3ba4e41f384b 100644 (file)
@@ -192,12 +192,12 @@ int test(char *URL)
     abort_on_test_timeout();
 
     /* See how the transfers went */
-    while ((msg = curl_multi_info_read(m, &msgs_left))) {
-      if (msg->msg == CURLMSG_DONE) {
+    while((msg = curl_multi_info_read(m, &msgs_left))) {
+      if(msg->msg == CURLMSG_DONE) {
         int i, found = 0;
 
         /* Find out which handle this message is about */
-        for (i = 0; i < num_handles; i++) {
+        for(i = 0; i < num_handles; i++) {
           found = (msg->easy_handle == handles[i]);
           if(found)
             break;
index e249d9f9db999661479f1bed55e8963f17a878ec..43b05982c475667ba87e8b196229a87a83c55f70 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -63,12 +63,12 @@ int test(char *URL)
   CURL *curl;
   char *ipstr=NULL;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -92,42 +92,42 @@ int test(char *URL)
 
   if(!res) {
     res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ipstr);
-    if (libtest_arg2) {
+    if(libtest_arg2) {
       FILE *moo = fopen(libtest_arg2, "wb");
       if(moo) {
-       double time_namelookup;
-       double time_connect;
-       double time_pretransfer;
-       double time_starttransfer;
-       double time_total;
-       fprintf(moo, "IP: %s\n", ipstr);
-       curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup);
-       curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect);
-       curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer);
-       curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
-                         &time_starttransfer);
-       curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total);
-
-       /* since the timing will always vary we only compare relative differences
-          between these 5 times */
-       if(time_namelookup > time_connect) {
-         fprintf(moo, "namelookup vs connect: %f %f\n",
-                 time_namelookup, time_connect);
-       }
-       if(time_connect > time_pretransfer) {
-         fprintf(moo, "connect vs pretransfer: %f %f\n",
-                 time_connect, time_pretransfer);
-       }
-       if(time_pretransfer > time_starttransfer) {
-         fprintf(moo, "pretransfer vs starttransfer: %f %f\n",
-                 time_pretransfer, time_starttransfer);
-       }
-       if(time_starttransfer > time_total) {
-         fprintf(moo, "starttransfer vs total: %f %f\n",
-                 time_starttransfer, time_total);
-       }
-
-       fclose(moo);
+        double time_namelookup;
+        double time_connect;
+        double time_pretransfer;
+        double time_starttransfer;
+        double time_total;
+        fprintf(moo, "IP: %s\n", ipstr);
+        curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup);
+        curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect);
+        curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer);
+        curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
+                          &time_starttransfer);
+        curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total);
+
+        /* since the timing will always vary we only compare relative
+           differences between these 5 times */
+        if(time_namelookup > time_connect) {
+          fprintf(moo, "namelookup vs connect: %f %f\n",
+                  time_namelookup, time_connect);
+        }
+        if(time_connect > time_pretransfer) {
+          fprintf(moo, "connect vs pretransfer: %f %f\n",
+                  time_connect, time_pretransfer);
+        }
+        if(time_pretransfer > time_starttransfer) {
+          fprintf(moo, "pretransfer vs starttransfer: %f %f\n",
+                  time_pretransfer, time_starttransfer);
+        }
+        if(time_starttransfer > time_total) {
+          fprintf(moo, "starttransfer vs total: %f %f\n",
+                  time_starttransfer, time_total);
+        }
+
+        fclose(moo);
       }
     }
   }
index b1b9ad413df3b8fc6b1cdd7e7b4779ae034a0b92..2a105f0cd1115c14a74cbee9ec299ea512c1daa0 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -30,12 +30,12 @@ int test(char *URL)
 
   (void)URL; /* we don't use this */
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 55734205996bf665178758739894e7458a44a7af..3466dc948dba630a450807b1bef6915dc644b517 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -50,7 +50,7 @@ int test(char *URL)
 
   /* The point here is that there must not be anything running on the given
      proxy port */
-  if (libtest_arg2)
+  if(libtest_arg2)
     easy_setopt(c, CURLOPT_PROXY, libtest_arg2);
   easy_setopt(c, CURLOPT_URL, URL);
   easy_setopt(c, CURLOPT_VERBOSE, 1L);
index 79c3bc79b105a8453425f9e80b3a55a2141e968a..127fde77eb5cd2775a83173d02286fc885a17246 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -38,8 +38,8 @@ int test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
-  FILE *hd_src ;
-  int hd ;
+  FILE *hd_src;
+  int hd;
   struct_stat file_info;
   struct curl_slist *hl;
   int error;
@@ -48,7 +48,7 @@ int test(char *URL)
   const char *buf_1 = "RNFR 505";
   const char *buf_2 = "RNTO 505-forreal";
 
-  if (!libtest_arg2) {
+  if(!libtest_arg2) {
     fprintf(stderr, "Usage: <url> <file-to-upload>\n");
     return TEST_ERR_USAGE;
   }
@@ -56,7 +56,7 @@ int test(char *URL)
   hd_src = fopen(libtest_arg2, "rb");
   if(NULL == hd_src) {
     error = ERRNO;
-    fprintf(stderr, "fopen() failed with error: %d %s\n",
+    fprintf(stderr, "fopen failed with error: %d %s\n",
             error, strerror(error));
     fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
     return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
@@ -80,14 +80,15 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* get a curl handle */
-  if ((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(hd_src);
@@ -96,14 +97,16 @@ int test(char *URL)
 
   /* build a list of commands to pass to libcurl */
 
-  if ((hl = curl_slist_append(headerlist, buf_1)) == NULL) {
+  hl = curl_slist_append(headerlist, buf_1);
+  if(!hl) {
     fprintf(stderr, "curl_slist_append() failed\n");
     curl_easy_cleanup(curl);
     curl_global_cleanup();
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
-  if ((headerlist = curl_slist_append(hl, buf_2)) == NULL) {
+  headerlist = curl_slist_append(hl, buf_2);
+  if(!headerlist) {
     fprintf(stderr, "curl_slist_append() failed\n");
     curl_slist_free_all(hl);
     curl_easy_cleanup(curl);
@@ -120,7 +123,7 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
 
   /* specify target */
-  test_setopt(curl,CURLOPT_URL, URL);
+  test_setopt(curl, CURLOPT_URL, URL);
 
   /* pass in that last of FTP commands to run after the transfer */
   test_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
index 4ee384f04a8687f2661ce3ac108c86c8e3c2b991..265b1ed5cc8d66db16b0b09f25c370851c73e60c 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -40,8 +40,8 @@ struct userdata {
 int lock[3];
 
 /* lock callback */
-static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess,
-          void *useptr )
+static void my_lock(CURL *handle, curl_lock_data data,
+                    curl_lock_access laccess, void *useptr)
 {
   const char *what;
   struct userdata *user = (struct userdata *)useptr;
@@ -50,7 +50,7 @@ static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess,
   (void)handle;
   (void)laccess;
 
-  switch ( data ) {
+  switch (data) {
     case CURL_LOCK_DATA_SHARE:
       what = "share";
       locknum = 0;
@@ -86,7 +86,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr )
   struct userdata *user = (struct userdata *)useptr;
   int locknum;
   (void)handle;
-  switch ( data ) {
+  switch (data) {
     case CURL_LOCK_DATA_SHARE:
       what = "share";
       locknum = 0;
@@ -120,7 +120,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr )
 static struct curl_slist *sethost(struct curl_slist *headers)
 {
   (void)headers;
-  return curl_slist_append(NULL, HOSTHEADER );
+  return curl_slist_append(NULL, HOSTHEADER);
 }
 
 
@@ -133,7 +133,8 @@ static void *fire(void *ptr)
   CURL *curl;
   int i=0;
 
-  if ((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     return NULL;
   }
@@ -142,17 +143,17 @@ static void *fire(void *ptr)
   curl_easy_setopt(curl, CURLOPT_VERBOSE,    1L);
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
   curl_easy_setopt(curl, CURLOPT_URL,        tdata->url);
-  printf( "CURLOPT_SHARE\n" );
+  printf("CURLOPT_SHARE\n");
   curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share);
 
-  printf( "PERFORM\n" );
+  printf("PERFORM\n");
   code = curl_easy_perform(curl);
-  if( code != CURLE_OK ) {
+  if(code) {
     fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
             tdata->url, i, (int)code);
   }
 
-  printf( "CLEANUP\n" );
+  printf("CLEANUP\n");
   curl_easy_cleanup(curl);
   curl_slist_free_all(headers);
 
@@ -186,42 +187,42 @@ int test(char *URL)
   user.text = (char *)"Pigs in space";
   user.counter = 0;
 
-  printf( "GLOBAL_INIT\n" );
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  printf("GLOBAL_INIT\n");
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* prepare share */
-  printf( "SHARE_INIT\n" );
-  if ((share = curl_share_init()) == NULL) {
+  printf("SHARE_INIT\n");
+  if((share = curl_share_init()) == NULL) {
     fprintf(stderr, "curl_share_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ( CURLSHE_OK == scode ) {
-    printf( "CURLSHOPT_LOCKFUNC\n" );
-    scode = curl_share_setopt( share, CURLSHOPT_LOCKFUNC, my_lock);
+  if(CURLSHE_OK == scode) {
+    printf("CURLSHOPT_LOCKFUNC\n");
+    scode = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, my_lock);
   }
-  if ( CURLSHE_OK == scode ) {
-    printf( "CURLSHOPT_UNLOCKFUNC\n" );
-    scode = curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, my_unlock);
+  if(CURLSHE_OK == scode) {
+    printf("CURLSHOPT_UNLOCKFUNC\n");
+    scode = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, my_unlock);
   }
-  if ( CURLSHE_OK == scode ) {
-    printf( "CURLSHOPT_USERDATA\n" );
-    scode = curl_share_setopt( share, CURLSHOPT_USERDATA, &user);
+  if(CURLSHE_OK == scode) {
+    printf("CURLSHOPT_USERDATA\n");
+    scode = curl_share_setopt(share, CURLSHOPT_USERDATA, &user);
   }
-  if ( CURLSHE_OK == scode ) {
-    printf( "CURL_LOCK_DATA_COOKIE\n" );
-    scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
+  if(CURLSHE_OK == scode) {
+    printf("CURL_LOCK_DATA_COOKIE\n");
+    scode = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
   }
-  if ( CURLSHE_OK == scode ) {
-    printf( "CURL_LOCK_DATA_DNS\n" );
-    scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
+  if(CURLSHE_OK == scode) {
+    printf("CURL_LOCK_DATA_DNS\n");
+    scode = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
   }
 
-  if ( CURLSHE_OK != scode ) {
+  if(CURLSHE_OK != scode) {
     fprintf(stderr, "curl_share_setopt() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
@@ -229,149 +230,145 @@ int test(char *URL)
   }
 
   /* initial cookie manipulation */
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
-  printf( "CURLOPT_SHARE\n" );
-  test_setopt( curl, CURLOPT_SHARE,      share );
-  printf( "CURLOPT_COOKIELIST injected_and_clobbered\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST,
+  printf("CURLOPT_SHARE\n");
+  test_setopt(curl, CURLOPT_SHARE,      share);
+  printf("CURLOPT_COOKIELIST injected_and_clobbered\n");
+  test_setopt(curl, CURLOPT_COOKIELIST,
                "Set-Cookie: injected_and_clobbered=yes; "
-               "domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030" );
-  printf( "CURLOPT_COOKIELIST ALL\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST, "ALL" );
-  printf( "CURLOPT_COOKIELIST session\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST, "Set-Cookie: session=elephants" );
-  printf( "CURLOPT_COOKIELIST injected\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST,
+               "domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030");
+  printf("CURLOPT_COOKIELIST ALL\n");
+  test_setopt(curl, CURLOPT_COOKIELIST, "ALL");
+  printf("CURLOPT_COOKIELIST session\n");
+  test_setopt(curl, CURLOPT_COOKIELIST, "Set-Cookie: session=elephants");
+  printf("CURLOPT_COOKIELIST injected\n");
+  test_setopt(curl, CURLOPT_COOKIELIST,
                "Set-Cookie: injected=yes; domain=host.foo.com; "
-               "expires=Sat Feb 2 11:56:27 GMT 2030" );
-  printf( "CURLOPT_COOKIELIST SESS\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST, "SESS" );
-  printf( "CLEANUP\n" );
-  curl_easy_cleanup( curl );
+               "expires=Sat Feb 2 11:56:27 GMT 2030");
+  printf("CURLOPT_COOKIELIST SESS\n");
+  test_setopt(curl, CURLOPT_COOKIELIST, "SESS");
+  printf("CLEANUP\n");
+  curl_easy_cleanup(curl);
 
 
   res = 0;
 
   /* start treads */
-  for (i=1; i<=THREADS; i++ ) {
+  for(i=1; i<=THREADS; i++) {
 
     /* set thread data */
-    tdata.url   = suburl( URL, i ); /* must be curl_free()d */
+    tdata.url   = suburl(URL, i); /* must be curl_free()d */
     tdata.share = share;
 
     /* simulate thread, direct call of "thread" function */
-    printf( "*** run %d\n",i );
-    fire( &tdata );
-
-    curl_free( tdata.url );
+    printf("*** run %d\n",i);
+    fire(&tdata);
 
+    curl_free(tdata.url);
   }
 
 
   /* fetch a another one and save cookies */
-  printf( "*** run %d\n", i );
-  if ((curl = curl_easy_init()) == NULL) {
+  printf("*** run %d\n", i);
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
-  url = suburl( URL, i );
-  headers = sethost( NULL );
-  test_setopt( curl, CURLOPT_HTTPHEADER, headers );
-  test_setopt( curl, CURLOPT_URL,        url );
-  printf( "CURLOPT_SHARE\n" );
-  test_setopt( curl, CURLOPT_SHARE,      share );
-  printf( "CURLOPT_COOKIEJAR\n" );
-  test_setopt( curl, CURLOPT_COOKIEJAR,  JAR );
-  printf( "CURLOPT_COOKIELIST FLUSH\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST, "FLUSH" );
-
-  printf( "PERFORM\n" );
-  curl_easy_perform( curl );
-
-  printf( "CLEANUP\n" );
-  curl_easy_cleanup( curl );
+  url = suburl(URL, i);
+  headers = sethost(NULL);
+  test_setopt(curl, CURLOPT_HTTPHEADER, headers);
+  test_setopt(curl, CURLOPT_URL,        url);
+  printf("CURLOPT_SHARE\n");
+  test_setopt(curl, CURLOPT_SHARE,      share);
+  printf("CURLOPT_COOKIEJAR\n");
+  test_setopt(curl, CURLOPT_COOKIEJAR,  JAR);
+  printf("CURLOPT_COOKIELIST FLUSH\n");
+  test_setopt(curl, CURLOPT_COOKIELIST, "FLUSH");
+
+  printf("PERFORM\n");
+  curl_easy_perform(curl);
+
+  printf("CLEANUP\n");
+  curl_easy_cleanup(curl);
   curl_free(url);
-  curl_slist_free_all( headers );
+  curl_slist_free_all(headers);
 
   /* load cookies */
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
-  url = suburl( URL, i );
-  headers = sethost( NULL );
-  test_setopt( curl, CURLOPT_HTTPHEADER, headers );
-  test_setopt( curl, CURLOPT_URL,        url );
-  printf( "CURLOPT_SHARE\n" );
-  test_setopt( curl, CURLOPT_SHARE,      share );
-  printf( "CURLOPT_COOKIELIST ALL\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST, "ALL" );
-  printf( "CURLOPT_COOKIEJAR\n" );
-  test_setopt( curl, CURLOPT_COOKIEFILE, JAR );
-  printf( "CURLOPT_COOKIELIST RELOAD\n" );
-  test_setopt( curl, CURLOPT_COOKIELIST, "RELOAD" );
+  url = suburl(URL, i);
+  headers = sethost(NULL);
+  test_setopt(curl, CURLOPT_HTTPHEADER, headers);
+  test_setopt(curl, CURLOPT_URL,        url);
+  printf("CURLOPT_SHARE\n");
+  test_setopt(curl, CURLOPT_SHARE,      share);
+  printf("CURLOPT_COOKIELIST ALL\n");
+  test_setopt(curl, CURLOPT_COOKIELIST, "ALL");
+  printf("CURLOPT_COOKIEJAR\n");
+  test_setopt(curl, CURLOPT_COOKIEFILE, JAR);
+  printf("CURLOPT_COOKIELIST RELOAD\n");
+  test_setopt(curl, CURLOPT_COOKIELIST, "RELOAD");
 
   code = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
-  if ( code != CURLE_OK )
-  {
+  if(code != CURLE_OK) {
     fprintf(stderr, "curl_easy_getinfo() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   printf("loaded cookies:\n");
-  if ( !cookies )
-  {
+  if(!cookies) {
     fprintf(stderr, "  reloading cookies from '%s' failed\n", JAR);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   printf("-----------------\n");
   next_cookie = cookies;
-  while ( next_cookie )
-  {
-    printf( "  %s\n", next_cookie->data );
+  while(next_cookie) {
+    printf("  %s\n", next_cookie->data);
     next_cookie = next_cookie->next;
   }
   printf("-----------------\n");
-  curl_slist_free_all( cookies );
+  curl_slist_free_all(cookies);
 
   /* try to free share, expect to fail because share is in use*/
-  printf( "try SHARE_CLEANUP...\n" );
-  scode = curl_share_cleanup( share );
-  if ( scode==CURLSHE_OK )
-  {
+  printf("try SHARE_CLEANUP...\n");
+  scode = curl_share_cleanup(share);
+  if(scode==CURLSHE_OK ) {
     fprintf(stderr, "curl_share_cleanup succeed but error expected\n");
     share = NULL;
-  } else {
-    printf( "SHARE_CLEANUP failed, correct\n" );
+  }
+  else {
+    printf("SHARE_CLEANUP failed, correct\n");
   }
 
 test_cleanup:
 
   /* clean up last handle */
-  printf( "CLEANUP\n" );
-  curl_easy_cleanup( curl );
-  curl_slist_free_all( headers );
+  printf("CLEANUP\n");
+  curl_easy_cleanup(curl);
+  curl_slist_free_all(headers);
   curl_free(url);
 
   /* free share */
-  printf( "SHARE_CLEANUP\n" );
-  scode = curl_share_cleanup( share );
-  if ( scode!=CURLSHE_OK )
+  printf("SHARE_CLEANUP\n");
+  scode = curl_share_cleanup(share);
+  if(scode!=CURLSHE_OK )
     fprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
             (int)scode);
 
-  printf( "GLOBAL_CLEANUP\n" );
+  printf("GLOBAL_CLEANUP\n");
   curl_global_cleanup();
 
   return res;
index 5b2ff1f295487c2cedbb8796e874edbb4c884717..cb60ce1bd694850c23fab12d54ee9734fa009862 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -57,12 +57,12 @@ int test(char *URL)
   pooh.readptr = data;
   pooh.sizeleft = strlen(data);
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 1f9e3e499453eb98241126f1d4fc1c2611c112c9..085a9753eaffd47277f7e8f39a61bdc24bbc7d9a 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -117,12 +117,12 @@ int test(char *URL)
                              custom_realloc,
                              custom_strdup,
                              custom_calloc);
-  if (res != CURLE_OK) {
+  if(res != CURLE_OK) {
     fprintf(stderr, "curl_global_init_mem() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index f84af76c054dba78e0e3387ac9213b8bf322d61f..cb5296ec36c20ac430a9eab5317273602ef05957 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -63,19 +63,19 @@ int test(char *URL)
   struct WriteThis pooh;
   pooh.counter = 0;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
-  if (slist == NULL) {
+  if(slist == NULL) {
     fprintf(stderr, "curl_slist_append() failed\n");
     curl_easy_cleanup(curl);
     curl_global_cleanup();
index 81dc75311bb1f86bedad095b15fe4c46e34e9ef9..0b7ae6f43b2ea8928e43ceb31dc48ec4b7fb04c7 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 6462ac7d59be7afe6b6e367a7b90858184ffea4e..b2f1d77882bba65ae861094d53ccb7662738a51b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -37,12 +37,12 @@ int test(char *URL)
   CURL *curl;
   CURLcode res=CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 916ed6b932b0c3490c09129de7ca6f12736697ff..75c5acc4aa5db636587b7f332b22493e25add7b6 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURL *curl;
   CURLcode res=CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index d982145ac8a0d5a7ef9936a2ca187c88e8d90718..f9ace04ee1c1ac5dc5c6ca7328d6d7fca10ae12a 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURL *curl;
   CURLcode res=CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 4c04af63ffa2a7bb6f84417f06dd1e607304a5e2..13b3b3d17ca8452a03cf00bd539f399b2e9c6e9a 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURL *curl;
   CURLcode res=CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 3e6c492dc5655a9395a5d02c380deac4947ab983..e37a7771d131f07e255c114c652261477adb5d95 100644 (file)
@@ -56,18 +56,19 @@ static char msgbuff[256];
 
 static void store_errmsg(const char *msg, int err)
 {
-  if (!err)
+  if(!err)
     snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
   else
-    snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err, strerror(err));
+    snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
+             err, strerror(err));
 }
 
 static void close_file_descriptors(void)
 {
-  for (num_open.rlim_cur = 0;
-       num_open.rlim_cur < num_open.rlim_max;
-       num_open.rlim_cur++)
-    if (fd[num_open.rlim_cur] > 0)
+  for(num_open.rlim_cur = 0;
+      num_open.rlim_cur < num_open.rlim_max;
+      num_open.rlim_cur++)
+    if(fd[num_open.rlim_cur] > 0)
       close(fd[num_open.rlim_cur]);
   free(fd);
   fd = NULL;
@@ -79,20 +80,20 @@ static int fopen_works(void)
   int i;
   int ret = 1;
 
-  for (i = 0; i < 3; i++) {
+  for(i = 0; i < 3; i++) {
     fpa[i] = NULL;
   }
-  for (i = 0; i < 3; i++) {
-    fpa[i] = fopen(DEV_NULL, "r");
-    if (fpa[i] == NULL) {
-      store_errmsg("fopen() failed", ERRNO);
+  for(i = 0; i < 3; i++) {
+    fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
+    if(fpa[i] == NULL) {
+      store_errmsg("fopen failed", ERRNO);
       fprintf(stderr, "%s\n", msgbuff);
       ret = 0;
       break;
     }
   }
-  for (i = 0; i < 3; i++) {
-    if (fpa[i] != NULL)
+  for(i = 0; i < 3; i++) {
+    if(fpa[i] != NULL)
       fclose(fpa[i]);
   }
   return ret;
@@ -112,7 +113,7 @@ static int rlimit(int keep_open)
 #ifdef HAVE_LONGLONG
   char fmt_llu[] = "%llu";
 
-  if (sizeof(rl.rlim_max) > sizeof(long))
+  if(sizeof(rl.rlim_max) > sizeof(long))
     fmt = fmt_llu;
   else
 #endif
@@ -120,7 +121,7 @@ static int rlimit(int keep_open)
 
   /* get initial open file limits */
 
-  if (getrlimit(RLIMIT_NOFILE, &rl) != 0) {
+  if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
     store_errmsg("getrlimit() failed", ERRNO);
     fprintf(stderr, "%s\n", msgbuff);
     return -1;
@@ -129,7 +130,7 @@ static int rlimit(int keep_open)
   /* show initial open file limits */
 
 #ifdef RLIM_INFINITY
-  if (rl.rlim_cur == RLIM_INFINITY)
+  if(rl.rlim_cur == RLIM_INFINITY)
     strcpy(strbuff, "INFINITY");
   else
 #endif
@@ -137,7 +138,7 @@ static int rlimit(int keep_open)
   fprintf(stderr, "initial soft limit: %s\n", strbuff);
 
 #ifdef RLIM_INFINITY
-  if (rl.rlim_max == RLIM_INFINITY)
+  if(rl.rlim_max == RLIM_INFINITY)
     strcpy(strbuff, "INFINITY");
   else
 #endif
@@ -159,14 +160,14 @@ static int rlimit(int keep_open)
    * open more than soft limit file descriptors will fail.
    */
 
-  if (rl.rlim_cur != rl.rlim_max) {
+  if(rl.rlim_cur != rl.rlim_max) {
 
 #ifdef OPEN_MAX
-    if ((rl.rlim_cur > 0) &&
-        (rl.rlim_cur < OPEN_MAX)) {
+    if((rl.rlim_cur > 0) &&
+       (rl.rlim_cur < OPEN_MAX)) {
       fprintf(stderr, "raising soft limit up to OPEN_MAX\n");
       rl.rlim_cur = OPEN_MAX;
-      if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
+      if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
         /* on failure don't abort just issue a warning */
         store_errmsg("setrlimit() failed", ERRNO);
         fprintf(stderr, "%s\n", msgbuff);
@@ -177,7 +178,7 @@ static int rlimit(int keep_open)
 
     fprintf(stderr, "raising soft limit up to hard limit\n");
     rl.rlim_cur = rl.rlim_max;
-    if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
+    if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
       /* on failure don't abort just issue a warning */
       store_errmsg("setrlimit() failed", ERRNO);
       fprintf(stderr, "%s\n", msgbuff);
@@ -186,7 +187,7 @@ static int rlimit(int keep_open)
 
     /* get current open file limits */
 
-    if (getrlimit(RLIMIT_NOFILE, &rl) != 0) {
+    if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
       store_errmsg("getrlimit() failed", ERRNO);
       fprintf(stderr, "%s\n", msgbuff);
       return -3;
@@ -195,7 +196,7 @@ static int rlimit(int keep_open)
     /* show current open file limits */
 
 #ifdef RLIM_INFINITY
-    if (rl.rlim_cur == RLIM_INFINITY)
+    if(rl.rlim_cur == RLIM_INFINITY)
       strcpy(strbuff, "INFINITY");
     else
 #endif
@@ -203,7 +204,7 @@ static int rlimit(int keep_open)
     fprintf(stderr, "current soft limit: %s\n", strbuff);
 
 #ifdef RLIM_INFINITY
-    if (rl.rlim_max == RLIM_INFINITY)
+    if(rl.rlim_max == RLIM_INFINITY)
       strcpy(strbuff, "INFINITY");
     else
 #endif
@@ -229,7 +230,7 @@ static int rlimit(int keep_open)
 
   num_open.rlim_cur = NUM_NEEDED;
 
-  if ((rl.rlim_cur > 0) &&
+  if((rl.rlim_cur > 0) &&
 #ifdef RLIM_INFINITY
      (rl.rlim_cur != RLIM_INFINITY) &&
 #endif
@@ -252,21 +253,21 @@ static int rlimit(int keep_open)
    * that it becomes available to the test.
    */
 
-  for (nitems = i = 1; nitems <= i; i *= 2)
+  for(nitems = i = 1; nitems <= i; i *= 2)
     nitems = i;
-  if (nitems > 0x7fff)
+  if(nitems > 0x7fff)
     nitems = 0x40000;
   do {
     num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems;
     snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
     fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
     memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
-    if (!memchunk) {
+    if(!memchunk) {
       fprintf(stderr, "memchunk, malloc() failed\n");
       nitems /= 2;
     }
-  } while (nitems && !memchunk);
-  if (!memchunk) {
+  } while(nitems && !memchunk);
+  if(!memchunk) {
     store_errmsg("memchunk, malloc() failed", ERRNO);
     fprintf(stderr, "%s\n", msgbuff);
     return -5;
@@ -276,7 +277,7 @@ static int rlimit(int keep_open)
 
   fprintf(stderr, "initializing memchunk array\n");
 
-  for (i = 0; i < nitems; i++)
+  for(i = 0; i < nitems; i++)
     memchunk[i] = -1;
 
   /* set the number of file descriptors we will try to open */
@@ -285,7 +286,7 @@ static int rlimit(int keep_open)
 
   /* verify that we won't overflow size_t in malloc() */
 
-  if ((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
+  if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
     snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
     snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
              "file descriptors, would overflow size_t", strbuff1);
@@ -301,7 +302,7 @@ static int rlimit(int keep_open)
   fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
 
   fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
-  if (!fd) {
+  if(!fd) {
     store_errmsg("fd, malloc() failed", ERRNO);
     fprintf(stderr, "%s\n", msgbuff);
     free(memchunk);
@@ -312,9 +313,9 @@ static int rlimit(int keep_open)
 
   fprintf(stderr, "initializing fd array\n");
 
-  for (num_open.rlim_cur = 0;
-       num_open.rlim_cur < num_open.rlim_max;
-       num_open.rlim_cur++)
+  for(num_open.rlim_cur = 0;
+      num_open.rlim_cur < num_open.rlim_max;
+      num_open.rlim_cur++)
     fd[num_open.rlim_cur] = -1;
 
   snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
@@ -323,7 +324,7 @@ static int rlimit(int keep_open)
   /* open a dummy descriptor */
 
   fd[0] = open(DEV_NULL, O_RDONLY);
-  if (fd[0] < 0) {
+  if(fd[0] < 0) {
     snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
     store_errmsg(strbuff, ERRNO);
     fprintf(stderr, "%s\n", msgbuff);
@@ -335,13 +336,13 @@ static int rlimit(int keep_open)
 
   /* create a bunch of file descriptors */
 
-  for (num_open.rlim_cur = 1;
-       num_open.rlim_cur < num_open.rlim_max;
-       num_open.rlim_cur++) {
+  for(num_open.rlim_cur = 1;
+      num_open.rlim_cur < num_open.rlim_max;
+      num_open.rlim_cur++) {
 
     fd[num_open.rlim_cur] = dup(fd[0]);
 
-    if (fd[num_open.rlim_cur] < 0) {
+    if(fd[num_open.rlim_cur] < 0) {
 
       fd[num_open.rlim_cur] = -1;
 
@@ -350,7 +351,8 @@ static int rlimit(int keep_open)
       fprintf(stderr, "%s\n", strbuff);
 
       snprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
-      snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s", strbuff1);
+      snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+               strbuff1);
       fprintf(stderr, "%s\n", strbuff);
 
       num_open.rlim_max = NUM_NEEDED;
@@ -362,9 +364,9 @@ static int rlimit(int keep_open)
       store_errmsg(strbuff, 0);
       fprintf(stderr, "%s\n", msgbuff);
 
-      for (num_open.rlim_cur = 0;
-           fd[num_open.rlim_cur] >= 0;
-           num_open.rlim_cur++)
+      for(num_open.rlim_cur = 0;
+          fd[num_open.rlim_cur] >= 0;
+          num_open.rlim_cur++)
         close(fd[num_open.rlim_cur]);
       free(fd);
       fd = NULL;
@@ -394,7 +396,7 @@ static int rlimit(int keep_open)
    */
 
   num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
-  if (num_open.rlim_max > num_open.rlim_cur) {
+  if(num_open.rlim_max > num_open.rlim_cur) {
     snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
              FD_SETSIZE);
     store_errmsg(strbuff, 0);
@@ -405,10 +407,10 @@ static int rlimit(int keep_open)
   }
 
   num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
-  for (rl.rlim_cur = 0;
-       rl.rlim_cur < num_open.rlim_max;
-       rl.rlim_cur++) {
-    if ((fd[rl.rlim_cur] > 0) &&
+  for(rl.rlim_cur = 0;
+      rl.rlim_cur < num_open.rlim_max;
+      rl.rlim_cur++) {
+    if((fd[rl.rlim_cur] > 0) &&
        ((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
       snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
                FD_SETSIZE);
@@ -431,14 +433,14 @@ static int rlimit(int keep_open)
    * if it is capable of fopen()ing some additional files.
    */
 
-  if (!fopen_works()) {
+  if(!fopen_works()) {
     snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
     snprintf(strbuff, sizeof(strbuff),
-             "stdio fopen() fails with %s fds open()",
+             "fopen fails with %s fds open()",
              strbuff1);
     fprintf(stderr, "%s\n", msgbuff);
     snprintf(strbuff, sizeof(strbuff),
-             "stdio fopen() fails with lots of fds open()");
+             "fopen fails with lots of fds open()");
     store_errmsg(strbuff, 0);
     close_file_descriptors();
     free(memchunk);
@@ -452,7 +454,7 @@ static int rlimit(int keep_open)
 
   /* close file descriptors unless instructed to keep them */
 
-  if (!keep_open) {
+  if(!keep_open) {
     close_file_descriptors();
   }
 
@@ -473,7 +475,7 @@ int test(char *URL)
     return 0; /* sure, run this! */
   }
 
-  if (rlimit(TRUE)) {
+  if(rlimit(TRUE)) {
     /* failure */
     return TEST_ERR_MAJOR_BAD;
   }
@@ -481,13 +483,13 @@ int test(char *URL)
   /* run the test with the bunch of open file descriptors
      and close them all once the test is over */
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     close_file_descriptors();
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     close_file_descriptors();
     curl_global_cleanup();
index a95bc3c1aaac628bbd7f8006dc707c3b119571b3..730d42a3ce982a09ee0b5b271204c4140f61b6ce 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 556b66b304bd86bea6ec81370bda2c3fa8952c08..7e54cd180fab783c506cb47a20cc69d5579cff85 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index d15add773f8eb56f5f5d1b727bad86cce4a1ed37..e6d6b2387ec6eb1e4edb64138f1edd509103cb2f 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 3272df42a476bb2c3de5a9a98f38299554259a1e..f947382056af114a75467d651c154f302ac11ff4 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index e5ab187e0d7dc7ef616294341940523af9a8e715..77d486b006bae5c3f554fd52d1c08e7909c2de84 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 8290cad04c821b9790c61c81934e5f21294d999f..2daa1ef317a3996c1924396fc526bb789448bef7 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -34,7 +34,7 @@ int test(char *URL)
   int res = 0;
   CURL *curl = NULL;
   FILE *hd_src = NULL;
-  int hd ;
+  int hd;
   int error;
   struct_stat file_info;
   CURLM *m = NULL;
@@ -56,7 +56,7 @@ int test(char *URL)
   hd_src = fopen(libtest_arg2, "rb");
   if(NULL == hd_src) {
     error = ERRNO;
-    fprintf(stderr, "fopen() failed with error: %d (%s)\n",
+    fprintf(stderr, "fopen failed with error: %d (%s)\n",
             error, strerror(error));
     fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2);
     return TEST_ERR_FOPEN;
@@ -86,7 +86,7 @@ int test(char *URL)
   easy_setopt(curl, CURLOPT_UPLOAD, 1L);
 
   /* specify target */
-  easy_setopt(curl,CURLOPT_URL, URL);
+  easy_setopt(curl, CURLOPT_URL, URL);
 
   /* go verbose */
   easy_setopt(curl, CURLOPT_VERBOSE, 1L);
index 3e00776a34d1b14f8cf3b9cfb1f05e23144f2c74..4efb5387cdef8f3a5b899012aa6f5138916b00bb 100644 (file)
@@ -66,9 +66,9 @@ static void store_errmsg(const char *msg, int err)
 
 static void close_file_descriptors(void)
 {
-  for (num_open.rlim_cur = 0;
-       num_open.rlim_cur < num_open.rlim_max;
-       num_open.rlim_cur++)
+  for(num_open.rlim_cur = 0;
+      num_open.rlim_cur < num_open.rlim_max;
+      num_open.rlim_cur++)
     if(fd[num_open.rlim_cur] > 0)
       close(fd[num_open.rlim_cur]);
   free(fd);
@@ -81,19 +81,19 @@ static int fopen_works(void)
   int i;
   int ret = 1;
 
-  for (i = 0; i < 3; i++) {
+  for(i = 0; i < 3; i++) {
     fpa[i] = NULL;
   }
-  for (i = 0; i < 3; i++) {
-    fpa[i] = fopen(DEV_NULL, "r");
+  for(i = 0; i < 3; i++) {
+    fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
     if(fpa[i] == NULL) {
-      store_errmsg("fopen() failed", ERRNO);
+      store_errmsg("fopen failed", ERRNO);
       fprintf(stderr, "%s\n", msgbuff);
       ret = 0;
       break;
     }
   }
-  for (i = 0; i < 3; i++) {
+  for(i = 0; i < 3; i++) {
     if(fpa[i] != NULL)
       fclose(fpa[i]);
   }
@@ -227,7 +227,7 @@ static int rlimit(int keep_open)
    * that it becomes available to the test.
    */
 
-  for (nitems = i = 1; nitems <= i; i *= 2)
+  for(nitems = i = 1; nitems <= i; i *= 2)
     nitems = i;
   if(nitems > 0x7fff)
     nitems = 0x40000;
@@ -240,7 +240,7 @@ static int rlimit(int keep_open)
       fprintf(stderr, "memchunk, malloc() failed\n");
       nitems /= 2;
     }
-  } while (nitems && !memchunk);
+  } while(nitems && !memchunk);
   if(!memchunk) {
     store_errmsg("memchunk, malloc() failed", ERRNO);
     fprintf(stderr, "%s\n", msgbuff);
@@ -251,7 +251,7 @@ static int rlimit(int keep_open)
 
   fprintf(stderr, "initializing memchunk array\n");
 
-  for (i = 0; i < nitems; i++)
+  for(i = 0; i < nitems; i++)
     memchunk[i] = -1;
 
   /* set the number of file descriptors we will try to open */
@@ -266,7 +266,7 @@ static int rlimit(int keep_open)
   }
   else {
     /* a huge number of file descriptors */
-    for (nitems = i = 1; nitems <= i; i *= 2)
+    for(nitems = i = 1; nitems <= i; i *= 2)
       nitems = i;
     if(nitems > 0x7fff)
       nitems = 0x40000;
@@ -295,7 +295,7 @@ static int rlimit(int keep_open)
       fprintf(stderr, "fd, malloc() failed\n");
       num_open.rlim_max /= 2;
     }
-  } while (num_open.rlim_max && !fd);
+  } while(num_open.rlim_max && !fd);
   if(!fd) {
     store_errmsg("fd, malloc() failed", ERRNO);
     fprintf(stderr, "%s\n", msgbuff);
@@ -307,9 +307,9 @@ static int rlimit(int keep_open)
 
   fprintf(stderr, "initializing fd array\n");
 
-  for (num_open.rlim_cur = 0;
-       num_open.rlim_cur < num_open.rlim_max;
-       num_open.rlim_cur++)
+  for(num_open.rlim_cur = 0;
+      num_open.rlim_cur < num_open.rlim_max;
+      num_open.rlim_cur++)
     fd[num_open.rlim_cur] = -1;
 
   snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
@@ -330,9 +330,9 @@ static int rlimit(int keep_open)
 
   /* create a bunch of file descriptors */
 
-  for (num_open.rlim_cur = 1;
-       num_open.rlim_cur < num_open.rlim_max;
-       num_open.rlim_cur++) {
+  for(num_open.rlim_cur = 1;
+      num_open.rlim_cur < num_open.rlim_max;
+      num_open.rlim_cur++) {
 
     fd[num_open.rlim_cur] = dup(fd[0]);
 
@@ -345,19 +345,21 @@ static int rlimit(int keep_open)
       fprintf(stderr, "%s\n", strbuff);
 
       snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
-      snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s", strbuff1);
+      snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+               strbuff1);
       fprintf(stderr, "%s\n", strbuff);
 
       num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN;
 
       num_open.rlim_cur -= num_open.rlim_max;
       snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
-      snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors", strbuff1);
+      snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
+               strbuff1);
       fprintf(stderr, "%s\n", strbuff);
 
-      for (num_open.rlim_cur = num_open.rlim_max;
-           fd[num_open.rlim_cur] >= 0;
-           num_open.rlim_cur++) {
+      for(num_open.rlim_cur = num_open.rlim_max;
+          fd[num_open.rlim_cur] >= 0;
+          num_open.rlim_cur++) {
         close(fd[num_open.rlim_cur]);
         fd[num_open.rlim_cur] = -1;
       }
@@ -399,7 +401,8 @@ static int rlimit(int keep_open)
 
   num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
   if(num_open.rlim_max > num_open.rlim_cur) {
-    snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", FD_SETSIZE);
+    snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+             FD_SETSIZE);
     store_errmsg(strbuff, 0);
     fprintf(stderr, "%s\n", msgbuff);
     close_file_descriptors();
@@ -408,12 +411,13 @@ static int rlimit(int keep_open)
   }
 
   num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
-  for (rl.rlim_cur = 0;
-       rl.rlim_cur < num_open.rlim_max;
-       rl.rlim_cur++) {
+  for(rl.rlim_cur = 0;
+      rl.rlim_cur < num_open.rlim_max;
+      rl.rlim_cur++) {
     if((fd[rl.rlim_cur] > 0) &&
        ((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
-      snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", FD_SETSIZE);
+      snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+               FD_SETSIZE);
       store_errmsg(strbuff, 0);
       fprintf(stderr, "%s\n", msgbuff);
       close_file_descriptors();
@@ -435,10 +439,10 @@ static int rlimit(int keep_open)
 
   if(!fopen_works()) {
     snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
-    snprintf(strbuff, sizeof(strbuff), "stdio fopen() fails with %s fds open()",
+    snprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
             strbuff1);
     fprintf(stderr, "%s\n", msgbuff);
-    snprintf(strbuff, sizeof(strbuff), "stdio fopen() fails with lots of fds open()");
+    snprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
     store_errmsg(strbuff, 0);
     close_file_descriptors();
     free(memchunk);
index c6ca0d25823422ddeb237b0a894fa415fa516e88..34dee9245cdde44fb2c0436070eb266bec61decb 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -30,12 +30,12 @@ int test(char *URL)
    char *newURL = NULL;
    struct curl_slist *slist = NULL;
 
-   if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
      fprintf(stderr, "curl_global_init() failed\n");
      return TEST_ERR_MAJOR_BAD;
    }
 
-   if ((curl = curl_easy_init()) == NULL) {
+   if((curl = curl_easy_init()) == NULL) {
      fprintf(stderr, "curl_easy_init() failed\n");
      curl_global_cleanup();
      return TEST_ERR_MAJOR_BAD;
@@ -58,16 +58,15 @@ int test(char *URL)
     * even though no directories are stored in the ftpconn->dirs array (after a
     * call to freedirs).
     */
-   newURL = malloc(strlen(URL) + 3);
-   if (newURL == NULL) {
+   newURL = aprintf("%s./", URL);
+   if(newURL == NULL) {
      curl_easy_cleanup(curl);
      curl_global_cleanup();
      return TEST_ERR_MAJOR_BAD;
    }
-   newURL = strcat(strcpy(newURL, URL), "./");
 
    slist = curl_slist_append (NULL, "SYST");
-   if (slist == NULL) {
+   if(slist == NULL) {
      free(newURL);
      curl_easy_cleanup(curl);
      curl_global_cleanup();
index 89dc6bc77c30669a1b0123a1ea454e6a9c28760c..9b3b5a40e736620610b221f153b893b2d89c8a01 100644 (file)
@@ -113,7 +113,7 @@ static int loop(int num, CURLM *cm, const char* url, const char* userpwd,
   if(res)
     return res;
 
-  while (U) {
+  while(U) {
 
     int M = -99;
 
@@ -125,7 +125,7 @@ static int loop(int num, CURLM *cm, const char* url, const char* userpwd,
     if(res)
       return res;
 
-    if (U) {
+    if(U) {
       FD_ZERO(&R);
       FD_ZERO(&W);
       FD_ZERO(&E);
index 64c7d20f59d82f555a111b0fe775918ce19ad757..9992da7f5cb62cabc03abd7ece34a41527f1cc4b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -35,12 +35,12 @@ int test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
-  FILE *hd_src ;
+  FILE *hd_src;
   int hd;
   struct_stat file_info;
   int error;
 
-  if (!libtest_arg2) {
+  if(!libtest_arg2) {
     fprintf(stderr, "Usage: <url> <file-to-upload>\n");
     return TEST_ERR_USAGE;
   }
@@ -48,7 +48,7 @@ int test(char *URL)
   hd_src = fopen(libtest_arg2, "rb");
   if(NULL == hd_src) {
     error = ERRNO;
-    fprintf(stderr, "fopen() failed with error: %d %s\n",
+    fprintf(stderr, "fopen failed with error: %d %s\n",
             error, strerror(error));
     fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
     return -2; /* if this happens things are major weird */
@@ -72,14 +72,14 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* get a curl handle */
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(hd_src);
@@ -93,7 +93,7 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
 
   /* specify target */
-  test_setopt(curl,CURLOPT_URL, URL);
+  test_setopt(curl, CURLOPT_URL, URL);
 
   /* now specify which file to upload */
   test_setopt(curl, CURLOPT_READDATA, hd_src);
index 0d0d574fc56938c2278bbb751e4befc1c030aba2..2ce67b944335b98f6d6b2b9a8aad09a4ba6bd0ba 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -36,13 +36,13 @@ int test(char *URL)
   CURL *curl;
   CURLcode res = CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* get a curl handle */
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -58,7 +58,7 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_HEADER, 0L);
 
   /* specify target */
-  test_setopt(curl,CURLOPT_URL, URL);
+  test_setopt(curl, CURLOPT_URL, URL);
 
   /* Now run off and do what you've been told! */
   res = curl_easy_perform(curl);
index 367248389960e8f381b74e9f04e07eed7e628c16..6001e8f1cf912b1498d4b5d49b38aa55be64dd2d 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -36,7 +36,7 @@ int test(char *URL)
   char *s;
   (void)URL;
 
-  if ((easy = curl_easy_init()) == NULL) {
+  if((easy = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
index 9bd80d8755c39f321071e989c061862a83967e91..736744425f7275354fc2bc4df6dd6f3e1b31911b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -42,12 +42,12 @@ int test(char *URL)
   CURL *curl;
   CURLcode res=CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index c282be18698c7cc8cae631e47cc9b229514e0611..4ec42a3309d064d98d5ab2dce151564b95d84162 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -85,12 +85,12 @@ int test(char *URL)
   int counter=0;
 #endif
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -108,7 +108,8 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_IOCTLDATA, &counter);
   test_setopt(curl, CURLOPT_READFUNCTION, readcallback);
   test_setopt(curl, CURLOPT_READDATA, &counter);
-  /* We CANNOT do the POST fine without setting the size (or choose chunked)! */
+  /* We CANNOT do the POST fine without setting the size (or choose
+     chunked)! */
   test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS));
 #endif
   test_setopt(curl, CURLOPT_POST, 1L);
index 961a4ba5b2495ced9548b257ecf318993de90c3b..4b35c26caa6a3d56ef781d0a67a00962b73a6731 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -33,12 +33,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 408b60cdb89fa73c24c62c851ede6ae1649b477b..e63cebc4981671b6635cf84c93909e87fe402641 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -63,14 +63,14 @@ void dump(const char *text,
 
     for(c = 0; (c < width) && (i+c < size); c++) {
       /* check for 0D0A; if found, skip past and start a new line of output */
-      if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) {
+      if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) {
         i+=(c+2-width);
         break;
       }
       fprintf(stream, "%c",
               (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.');
       /* check again for 0D0A, to avoid an extra \n if it's at width */
-      if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) {
+      if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) {
         i+=(c+3-width);
         break;
       }
@@ -121,12 +121,14 @@ int my_trace(CURL *handle, curl_infotype type,
 
 
 static size_t current_offset = 0;
-static char databuf[70000]; /* MUST be more than 64k OR MAX_INITIAL_POST_SIZE */
+static char databuf[70000]; /* MUST be more than 64k OR
+                               MAX_INITIAL_POST_SIZE */
 
 static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 {
   size_t  amount = nmemb * size; /* Total bytes curl wants */
-  size_t  available = sizeof(databuf) - current_offset; /* What we have to give */
+  size_t  available = sizeof(databuf) - current_offset; /* What we have to
+                                                           give */
   size_t  given = amount < available ? amount : available; /* What is given */
   (void)stream;
   memcpy(ptr, databuf + current_offset, given);
@@ -135,7 +137,8 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 }
 
 
-static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream)
+static size_t write_callback(void *ptr, size_t size, size_t nmemb,
+                             void *stream)
 {
   int amount = curlx_uztosi(size * nmemb);
   printf("%.*s", amount, (char *)ptr);
@@ -147,7 +150,7 @@ static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 static curlioerr ioctl_callback(CURL * handle, int cmd, void *clientp)
 {
   (void)clientp;
-  if (cmd == CURLIOCMD_RESTARTREAD ) {
+  if(cmd == CURLIOCMD_RESTARTREAD ) {
     printf("APPLICATION: recieved a CURLIOCMD_RESTARTREAD request\n");
     printf("APPLICATION: ** REWINDING! **\n");
     current_offset = 0;
@@ -181,7 +184,7 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
 
   /* setup repeated data string */
-  for (i=0; i < sizeof(databuf); ++i)
+  for(i=0; i < sizeof(databuf); ++i)
       databuf[i] = fill[i % sizeof fill];
 
   /* Post */
@@ -206,7 +209,8 @@ int test(char *URL)
 
   test_setopt(curl, CURLOPT_URL, URL);
 
-  /* Accept any auth. But for this bug configure proxy with DIGEST, basic might work too, not NTLM */
+  /* Accept any auth. But for this bug configure proxy with DIGEST, basic
+     might work too, not NTLM */
   test_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY);
 
   res = curl_easy_perform(curl);
index ab4db74c745b0dd014be1739706cc311dfc89d8b..9afaad48f55755c2aad86baf6cbb4afcb19c90ba 100644 (file)
@@ -39,7 +39,7 @@ static size_t myreadfunc(void *ptr, size_t size, size_t nmemb, void *stream)
   memset(buf, 'A', sizeof(buf));
 
   size *= nmemb;
-  if (size > total)
+  if(size > total)
     size = total;
 
   if(size > sizeof(buf))
@@ -73,18 +73,18 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  for (i = 0; i < NUM_HEADERS; i++) {
+  for(i = 0; i < NUM_HEADERS; i++) {
     int len = snprintf(buf, sizeof(buf), "Header%d: ", i);
     memset(&buf[len], 'A', SIZE_HEADERS);
     buf[len + SIZE_HEADERS]=0; /* zero terminate */
     hl = curl_slist_append(headerlist,  buf);
-    if (!hl)
+    if(!hl)
       goto test_cleanup;
     headerlist = hl;
   }
 
   hl = curl_slist_append(headerlist, "Expect: ");
-  if (!hl)
+  if(!hl)
     goto test_cleanup;
   headerlist = hl;
 
index 23f0e2397c2aa655989421fcc3bc7c460434300d..803df26d1b4e14776f1be7e544bc855ed5f8db01 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -162,7 +162,7 @@ static int once(char *URL, bool oldstyle)
   if(formrc)
     printf("curl_formadd(4) = %d\n", (int)formrc);
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_formfree(formpost);
     curl_global_cleanup();
@@ -208,7 +208,7 @@ int test(char *URL)
 {
   int res;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
index fea4ea48c87f8731cda4d679600860255dfc39c1..6083c023750ab19a98489948356a03f05920c4a5 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -96,7 +96,8 @@ int test(char *URL)
   easy_setopt(curl, CURLOPT_IOCTLDATA, &counter);
   easy_setopt(curl, CURLOPT_READFUNCTION, readcallback);
   easy_setopt(curl, CURLOPT_READDATA, &counter);
-  /* We CANNOT do the POST fine without setting the size (or choose chunked)! */
+  /* We CANNOT do the POST fine without setting the size (or choose
+     chunked)! */
   easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(UPLOADTHIS));
 
   easy_setopt(curl, CURLOPT_POST, 1L);
@@ -113,7 +114,7 @@ int test(char *URL)
 
   multi_add_handle(m, curl);
 
-  while (running) {
+  while(running) {
     struct timeval timeout;
     fd_set fdread, fdwrite, fdexcep;
     int maxfd = -99;
index 3c1ff0ebbae137e0653f82918ef86e2de05f5c9e..a0b360b335ee3b214aa3245f5460ac59c030f868 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -40,12 +40,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 39475635be08a1ae8fb0661ef2e7d28453b9678c..05353aa978b7bf8340ff1a5ef3d34496e0f8f3ab 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2013, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -33,7 +33,7 @@ int test(char *URL)
 
   (void)URL; /* we don't use this */
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
index b5c3970d9eaf55f1d72739360a3cd62bda2fc1da..819b50759fdfbe8956cc0b348527528909cd22c3 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -40,13 +40,13 @@ int test(char *URL)
   CURL *curl;
   CURLcode res = CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* get a curl handle */
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -59,7 +59,7 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10));
 
   /* specify target */
-  test_setopt(curl,CURLOPT_URL, URL);
+  test_setopt(curl, CURLOPT_URL, URL);
 
   /* Now run off and do what you've been told! */
   res = curl_easy_perform(curl);
index fc03d4e7d22312944d21219b8d1704cb95f5d86f..59edb54f4b5fe953ac92875d48072c7464c5e2db 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -30,12 +30,12 @@ int test(char *URL)
 
   double content_length = 3;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 080efb1a39feb8c2aa7be488549672db89befccd..b71778d7cc9dae3d550da91202781c5c10a64b11 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -32,12 +32,12 @@ int test(char *URL)
   CURL *curl;
   struct curl_slist *custom_headers=NULL;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 3dfb94887340ec08194095372467e9fe584aa6c6..9b3a07787c9c5ae7253d76db0ea8e347662c6070 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -50,12 +50,12 @@ int test(char *URL)
   int request=1;
   struct curl_slist *custom_headers=NULL;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -131,7 +131,8 @@ int test(char *URL)
   }
   test_setopt(curl, CURLOPT_RTSPHEADER, custom_headers);
   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_ANNOUNCE);
-  test_setopt(curl, CURLOPT_POSTFIELDS, "postyfield=postystuff&project=curl\n");
+  test_setopt(curl, CURLOPT_POSTFIELDS,
+              "postyfield=postystuff&project=curl\n");
 
   res = curl_easy_perform(curl);
   if(res)
index 909a12cdaf23e12b613e632f57dee0cd088107c3..e8578fd3fd8be0e15279c767c7e785e34563630d 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -47,13 +47,13 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     fclose(idfile);
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(idfile);
@@ -86,7 +86,8 @@ int test(char *URL)
     stream_uri = NULL;
 
     test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
-    test_setopt(curl, CURLOPT_RTSP_TRANSPORT, "Fake/NotReal/JustATest;foo=baz");
+    test_setopt(curl, CURLOPT_RTSP_TRANSPORT,
+                "Fake/NotReal/JustATest;foo=baz");
     res = curl_easy_perform(curl);
     if(res)
       goto test_cleanup;
index db44985534b7e63f09c3660b77eb9d34f310f2e9..511a0a99f277f74c36bee2ab5adaa043a1a07703 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2013, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -35,12 +35,12 @@ int test(char *URL)
   int request=1;
   char *stream_uri = NULL;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 95c868485c922e1a5a19bd6bb3ef5d68fb3cd913..1a4b9d75e8a64d38dce4c09bb405c57a135de9c1 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2013, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -75,8 +75,9 @@ static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *stream) {
         printf("RTP PAYLOAD CORRUPTED [%s]\n", data + i);
         return failure;
       }
-    } else {
-      if (memcmp(RTP_DATA, data + i, message_size - i) != 0) {
+    }
+    else {
+      if(memcmp(RTP_DATA, data + i, message_size - i) != 0) {
         printf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n",
                message_size - i, data + i);
         return failure;
@@ -110,13 +111,13 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     fclose(protofile);
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     fclose(protofile);
     curl_global_cleanup();
index 9e7a9feca24e9761ae23fbad799ba1c3f742d4aa..bab9bae1a7f326f350314181e0becc23eb4703fa 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -50,12 +50,12 @@ int test(char *URL)
   int request=1;
   struct curl_slist *custom_headers=NULL;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 527c19b61619c84f4c8026c6f2a38d1981a59f4b..78840b7451e508b045de69389df92d9eb59b5e19 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -44,7 +44,7 @@ int test(char *URL)
   dbl_epsilon = 1.0;
   do {
     dbl_epsilon /= 2.0;
-  } while ((double)(1.0 + (dbl_epsilon/2.0)) > (double)1.0);
+  } while((double)(1.0 + (dbl_epsilon/2.0)) > (double)1.0);
 
   start_test_timing();
 
@@ -65,7 +65,7 @@ int test(char *URL)
 
   multi_add_handle(m, c);
 
-  while (running) {
+  while(running) {
     struct timeval timeout;
     fd_set fdread, fdwrite, fdexcep;
     int maxfd = -99;
@@ -94,7 +94,7 @@ int test(char *URL)
   }
 
   curl_easy_getinfo(c, CURLINFO_CONNECT_TIME, &connect_time);
-  if (connect_time < dbl_epsilon) {
+  if(connect_time < dbl_epsilon) {
     fprintf(stderr, "connect time %e is < epsilon %e\n",
             connect_time, dbl_epsilon);
     res = TEST_ERR_MAJOR_BAD;
index 6baeb00b92486752ab4f789f54ee71cf31b11a70..b29bd2ad5b3601ac1bd1006e3e79c151ce38216f 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -35,12 +35,12 @@ int test(char *URL)
   int res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 692faf39273ccdf1cee918fc8ec683577c467cb2..7bf5ab0290831474bb2469ec5d5a01e188799525 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -74,7 +74,8 @@ long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains)
   }
   if(finfo->filetype == CURLFILETYPE_FILE) {
     ch_d->print_content = 1;
-    printf("Content:\n-------------------------------------------------------------\n");
+    printf("Content:\n-----------------------"
+           "--------------------------------------\n");
   }
   if(strcmp(finfo->filename, "someothertext.txt") == 0) {
     printf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n");
@@ -100,7 +101,7 @@ int test(char *URL)
 {
   CURL *handle = NULL;
   CURLcode res = CURLE_OK;
-  chunk_data_t chunk_data = {0,0};
+  chunk_data_t chunk_data = {0, 0};
   curl_global_init(CURL_GLOBAL_ALL);
   handle = curl_easy_init();
   if(!handle) {
index 9189d6e4f624a6ba4b338af7bd5051756ea8a674..8d79dc0cc0c721c6a9fb30e1f9919e341bb6e6de 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,7 +28,8 @@ static char data[]="this is a short string.\n";
 
 static size_t data_size = sizeof(data) / sizeof(char);
 
-static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
+static int progress_callback(void *clientp, double dltotal, double dlnow,
+                             double ultotal, double ulnow)
 {
   FILE *moo = fopen(libtest_arg2, "wb");
 
@@ -37,10 +38,11 @@ static int progress_callback(void *clientp, double dltotal, double dlnow, double
   (void)dlnow; /* UNUSED */
 
   if(moo) {
-    if ((size_t)ultotal == data_size && (size_t)ulnow == data_size)
+    if((size_t)ultotal == data_size && (size_t)ulnow == data_size)
       fprintf(moo, "PASSED, UL data matched data size\n");
     else
-      fprintf(moo, "Progress callback called with UL %f out of %f\n", ulnow, ultotal);
+      fprintf(moo, "Progress callback called with UL %f out of %f\n",
+              ulnow, ultotal);
     fclose(moo);
   }
   return 0;
@@ -51,12 +53,12 @@ int test(char *URL)
   CURL *curl;
   CURLcode res=CURLE_OK;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index fc9f79168bc886e6ca21194e77bf6b13b102b1ca..63f3f052157d98df2829b1f36f3a52ea1c66be6b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -92,19 +92,19 @@ int test(char *URL)
   struct WriteThis pooh;
   pooh.counter = 0;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
-  if (slist == NULL) {
+  if(slist == NULL) {
     fprintf(stderr, "curl_slist_append() failed\n");
     curl_easy_cleanup(curl);
     curl_global_cleanup();
index 738aa63c27bcc1446f99f8699ca006ed78e13d34..444b416ff6ca2acd17aab15b299516ca96c82134 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -51,9 +51,9 @@ static void removeFd(struct Sockets* sockets, curl_socket_t fd, int mention)
   if(mention)
     fprintf(stderr, "Remove socket fd %d\n", (int) fd);
 
-  for (i = 0; i < sockets->count; ++i) {
-    if (sockets->sockets[i] == fd) {
-      if (i < sockets->count - 1)
+  for(i = 0; i < sockets->count; ++i) {
+    if(sockets->sockets[i] == fd) {
+      if(i < sockets->count - 1)
         memmove(&sockets->sockets[i], &sockets->sockets[i + 1],
               sizeof(curl_socket_t) * (sockets->count - (i + 1)));
       --sockets->count;
@@ -110,10 +110,10 @@ static int curlSocketCallback(CURL *easy, curl_socket_t s, int action,
   (void)easy; /* unused */
   (void)socketp; /* unused */
 
-  if (action == CURL_POLL_IN || action == CURL_POLL_INOUT)
+  if(action == CURL_POLL_IN || action == CURL_POLL_INOUT)
     addFd(&sockets->read, s, "read");
 
-  if (action == CURL_POLL_OUT || action == CURL_POLL_INOUT)
+  if(action == CURL_POLL_OUT || action == CURL_POLL_INOUT)
     addFd(&sockets->write, s, "write");
 
   if(action == CURL_POLL_REMOVE) {
@@ -132,7 +132,7 @@ static int curlTimerCallback(CURLM *multi, long timeout_ms, void *userp)
   struct timeval* timeout = userp;
 
   (void)multi; /* unused */
-  if (timeout_ms != -1) {
+  if(timeout_ms != -1) {
     *timeout = tutil_tvnow();
     timeout->tv_usec += timeout_ms * 1000;
   }
@@ -151,10 +151,10 @@ static int checkForCompletion(CURLM* curl, int* success)
   CURLMsg* message;
   int result = 0;
   *success = 0;
-  while ((message = curl_multi_info_read(curl, &numMessages)) != NULL) {
-    if (message->msg == CURLMSG_DONE) {
+  while((message = curl_multi_info_read(curl, &numMessages)) != NULL) {
+    if(message->msg == CURLMSG_DONE) {
       result = 1;
-      if (message->data.result == CURLE_OK)
+      if(message->data.result == CURLE_OK)
         *success = 1;
       else
         *success = 0;
@@ -176,7 +176,7 @@ static int getMicroSecondTimeout(struct timeval* timeout)
   now = tutil_tvnow();
   result = (timeout->tv_sec - now.tv_sec) * 1000000 +
     timeout->tv_usec - now.tv_usec;
-  if (result < 0)
+  if(result < 0)
     result = 0;
 
   return curlx_sztosi(result);
@@ -189,9 +189,9 @@ static void updateFdSet(struct Sockets* sockets, fd_set* fdset,
                         curl_socket_t *maxFd)
 {
   int i;
-  for (i = 0; i < sockets->count; ++i) {
+  for(i = 0; i < sockets->count; ++i) {
     FD_SET(sockets->sockets[i], fdset);
-    if (*maxFd < sockets->sockets[i] + 1) {
+    if(*maxFd < sockets->sockets[i] + 1) {
       *maxFd = sockets->sockets[i] + 1;
     }
   }
@@ -202,7 +202,7 @@ static void notifyCurl(CURLM *curl, curl_socket_t s, int evBitmask,
 {
   int numhandles = 0;
   CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
-  if (result != CURLM_OK) {
+  if(result != CURLM_OK) {
     fprintf(stderr, "Curl error on %s: %i (%s)\n",
             info, result, curl_multi_strerror(result));
   }
@@ -215,8 +215,8 @@ static void checkFdSet(CURLM *curl, struct Sockets *sockets, fd_set *fdset,
                        int evBitmask, const char *name)
 {
   int i;
-  for (i = 0; i < sockets->count; ++i) {
-    if (FD_ISSET(sockets->sockets[i], fdset)) {
+  for(i = 0; i < sockets->count; ++i) {
+    if(FD_ISSET(sockets->sockets[i], fdset)) {
       notifyCurl(curl, sockets->sockets[i], evBitmask, name);
     }
   }
@@ -227,7 +227,7 @@ int test(char *URL)
   int res = 0;
   CURL *curl = NULL;
   FILE *hd_src = NULL;
-  int hd ;
+  int hd;
   int error;
   struct_stat file_info;
   CURLM *m = NULL;
@@ -237,7 +237,7 @@ int test(char *URL)
 
   start_test_timing();
 
-  if (!libtest_arg3) {
+  if(!libtest_arg3) {
     fprintf(stderr, "Usage: lib582 [url] [filename] [username]\n");
     return TEST_ERR_USAGE;
   }
@@ -276,7 +276,7 @@ int test(char *URL)
   easy_setopt(curl, CURLOPT_UPLOAD, 1L);
 
   /* specify target */
-  easy_setopt(curl,CURLOPT_URL, URL);
+  easy_setopt(curl, CURLOPT_URL, URL);
 
   /* go verbose */
   easy_setopt(curl, CURLOPT_VERBOSE, 1L);
@@ -300,8 +300,7 @@ int test(char *URL)
 
   multi_add_handle(m, curl);
 
-  while (!checkForCompletion(m, &success))
-  {
+  while(!checkForCompletion(m, &success)) {
     fd_set readSet, writeSet;
     curl_socket_t maxFd = 0;
     struct timeval tv = {10, 0};
@@ -311,14 +310,12 @@ int test(char *URL)
     updateFdSet(&sockets.read, &readSet, &maxFd);
     updateFdSet(&sockets.write, &writeSet, &maxFd);
 
-    if (timeout.tv_sec != -1)
-    {
+    if(timeout.tv_sec != -1) {
       int usTimeout = getMicroSecondTimeout(&timeout);
       tv.tv_sec = usTimeout / 1000000;
       tv.tv_usec = usTimeout % 1000000;
     }
-    else if (maxFd <= 0)
-    {
+    else if(maxFd <= 0) {
       tv.tv_sec = 0;
       tv.tv_usec = 100000;
     }
@@ -329,8 +326,7 @@ int test(char *URL)
     checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read");
     checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write");
 
-    if (timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0)
-    {
+    if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) {
       /* Curl's timer has elapsed. */
       notifyCurl(m, CURL_SOCKET_TIMEOUT, 0, "timeout");
     }
@@ -338,8 +334,7 @@ int test(char *URL)
     abort_on_test_timeout();
   }
 
-  if (!success)
-  {
+  if(!success) {
     fprintf(stderr, "Error uploading file.\n");
     res = TEST_ERR_MAJOR_BAD;
   }
index 3965c7461c2217fe4a63492ba7835e33311a0e6f..55ab6b655782eee767f95d4802b2035a255eb0f0 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -36,8 +36,8 @@ struct userdata {
 };
 
 /* lock callback */
-static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess,
-          void *useptr )
+static void my_lock(CURL *handle, curl_lock_data data,
+                    curl_lock_access laccess, void *useptr)
 {
   const char *what;
   struct userdata *user = (struct userdata *)useptr;
@@ -101,7 +101,7 @@ static void *fire(void *ptr)
   CURL *curl;
   int i=0;
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     return NULL;
   }
@@ -114,7 +114,7 @@ static void *fire(void *ptr)
 
   printf( "PERFORM\n" );
   code = curl_easy_perform(curl);
-  if( code != CURLE_OK ) {
+  if(code != CURLE_OK ) {
     fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
             tdata->url, i, (int)code);
   }
@@ -141,37 +141,38 @@ int test(char *URL)
   user.counter = 0;
 
   printf( "GLOBAL_INIT\n" );
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* prepare share */
   printf( "SHARE_INIT\n" );
-  if ((share = curl_share_init()) == NULL) {
+  if((share = curl_share_init()) == NULL) {
     fprintf(stderr, "curl_share_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ( CURLSHE_OK == scode ) {
+  if(CURLSHE_OK == scode ) {
     printf( "CURLSHOPT_LOCKFUNC\n" );
     scode = curl_share_setopt( share, CURLSHOPT_LOCKFUNC, my_lock);
   }
-  if ( CURLSHE_OK == scode ) {
+  if(CURLSHE_OK == scode ) {
     printf( "CURLSHOPT_UNLOCKFUNC\n" );
     scode = curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, my_unlock);
   }
-  if ( CURLSHE_OK == scode ) {
+  if(CURLSHE_OK == scode ) {
     printf( "CURLSHOPT_USERDATA\n" );
     scode = curl_share_setopt( share, CURLSHOPT_USERDATA, &user);
   }
-  if ( CURLSHE_OK == scode ) {
+  if(CURLSHE_OK == scode ) {
     printf( "CURL_LOCK_DATA_SSL_SESSION\n" );
-    scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
+    scode = curl_share_setopt( share, CURLSHOPT_SHARE,
+                               CURL_LOCK_DATA_SSL_SESSION);
   }
 
-  if ( CURLSHE_OK != scode ) {
+  if(CURLSHE_OK != scode ) {
     fprintf(stderr, "curl_share_setopt() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
@@ -182,7 +183,7 @@ int test(char *URL)
   res = 0;
 
   /* start treads */
-  for (i=1; i<=THREADS; i++ ) {
+  for(i=1; i<=THREADS; i++ ) {
 
     /* set thread data */
     tdata.url   = URL;
@@ -196,7 +197,7 @@ int test(char *URL)
 
   /* fetch a another one */
   printf( "*** run %d\n", i );
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
@@ -214,11 +215,11 @@ int test(char *URL)
   /* try to free share, expect to fail because share is in use*/
   printf( "try SHARE_CLEANUP...\n" );
   scode = curl_share_cleanup( share );
-  if ( scode==CURLSHE_OK )
-  {
+  if(scode==CURLSHE_OK) {
     fprintf(stderr, "curl_share_cleanup succeed but error expected\n");
     share = NULL;
-  } else {
+  }
+  else {
     printf( "SHARE_CLEANUP failed, correct\n" );
   }
 
@@ -231,7 +232,7 @@ test_cleanup:
   /* free share */
   printf( "SHARE_CLEANUP\n" );
   scode = curl_share_cleanup( share );
-  if ( scode!=CURLSHE_OK )
+  if(scode!=CURLSHE_OK )
     fprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
             (int)scode);
 
index 44409afa6b1e3cc0a93f51070ab3d4d37a5602be..3d4d0bddffd8ea4f597e79422848398b2fadde38 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -41,12 +41,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 493d4d8dc2549f27b33e150aa39b209b1fac77bb..813af75411180f477c5d3cfad865892fd6f73b57 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -69,7 +69,7 @@ int test(char *URL)
 
   multi_init(multi);
 
-  for (phase = CONNECT_ONLY_PHASE; phase < LAST_PHASE; ++phase) {
+  for(phase = CONNECT_ONLY_PHASE; phase < LAST_PHASE; ++phase) {
     /* go verbose */
     easy_setopt(easy, CURLOPT_VERBOSE, 1L);
 
@@ -77,11 +77,11 @@ int test(char *URL)
     easy_setopt(easy, CURLOPT_URL, URL);
 
     /* enable 'CONNECT_ONLY' option when in connect phase */
-    if (phase == CONNECT_ONLY_PHASE)
+    if(phase == CONNECT_ONLY_PHASE)
       easy_setopt(easy, CURLOPT_CONNECT_ONLY, 1L);
 
     /* enable 'NOBODY' option to send 'QUIT' command in quit phase */
-    if (phase == QUIT_PHASE) {
+    if(phase == QUIT_PHASE) {
       easy_setopt(easy, CURLOPT_CONNECT_ONLY, 0L);
       easy_setopt(easy, CURLOPT_NOBODY, 1L);
       easy_setopt(easy, CURLOPT_FORBID_REUSE, 1L);
@@ -114,7 +114,8 @@ int test(char *URL)
 
       multi_timeout(multi, &timeout);
 
-      /* At this point, timeout is guaranteed to be greater or equal than -1. */
+      /* At this point, timeout is guaranteed to be greater or equal than
+         -1. */
 
       if(timeout != -1L) {
         int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
index 215ab57779ba70203d6270b2a8420946817ec608..12d4decb852e3a9aff3e40d2afd91d0ad2d3199b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -28,12 +28,12 @@ int test(char *URL)
   CURLcode res;
   CURL *curl;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 20b08916706e55b28980c42cc5578a2c36ebb9e1..f917f51a368eb333370c6582b8ca625dac78b71f 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -45,12 +45,12 @@ int test(char *URL)
   CURLcode res=CURLE_OK;
   double content_length = 0.0;
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -75,12 +75,12 @@ int test(char *URL)
   /* Perform the request, res will get the return code */
   res = curl_easy_perform(curl);
 
-  if (!res) {
+  if(!res) {
     FILE *moo;
     res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
                             &content_length);
     moo = fopen(libtest_arg2, "wb");
-    if (moo) {
+    if(moo) {
       fprintf(moo, "CL: %.0f\n", content_length);
       fclose(moo);
     }
index fac07fbee98976b83157cf01ff5386c86014a0c1..994f9de06cd57bdbf1a9de2730160224f4954110 100644 (file)
@@ -34,7 +34,7 @@ static CURLcode send_request(CURL *curl, const char *url, int seq,
   CURLcode res;
   size_t len = strlen(url) + 4 + 1;
   char* full_url = malloc(len);
-  if (!full_url) {
+  if(!full_url) {
     fprintf(stderr, "Not enough memory for full url\n");
     return CURLE_OUT_OF_MEMORY;
   }
@@ -70,13 +70,13 @@ static CURLcode send_right_password(CURL *curl, const char *url, int seq,
 
 static long parse_auth_name(const char *arg)
 {
-  if (!arg)
+  if(!arg)
     return CURLAUTH_NONE;
-  if (strequal(arg, "basic"))
+  if(strequal(arg, "basic"))
     return CURLAUTH_BASIC;
-  if (strequal(arg, "digest"))
+  if(strequal(arg, "digest"))
     return CURLAUTH_DIGEST;
-  if (strequal(arg, "ntlm"))
+  if(strequal(arg, "ntlm"))
     return CURLAUTH_NTLM;
   return CURLAUTH_NONE;
 }
@@ -89,58 +89,58 @@ int test(char *url)
   long main_auth_scheme = parse_auth_name(libtest_arg2);
   long fallback_auth_scheme = parse_auth_name(libtest_arg3);
 
-  if (main_auth_scheme == CURLAUTH_NONE ||
+  if(main_auth_scheme == CURLAUTH_NONE ||
       fallback_auth_scheme == CURLAUTH_NONE) {
     fprintf(stderr, "auth schemes not found on commandline\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* Send wrong password, then right password */
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   res = send_wrong_password(curl, url, 100, main_auth_scheme);
-  if (res != CURLE_OK)
-      goto test_cleanup;
+  if(res != CURLE_OK)
+    goto test_cleanup;
   curl_easy_reset(curl);
 
   res = send_right_password(curl, url, 200, fallback_auth_scheme);
-  if (res != CURLE_OK)
-      goto test_cleanup;
+  if(res != CURLE_OK)
+    goto test_cleanup;
   curl_easy_reset(curl);
 
   curl_easy_cleanup(curl);
 
   /* Send wrong password twice, then right password */
 
-  if ((curl = curl_easy_init()) == NULL) {
+  if((curl = curl_easy_init()) == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   res = send_wrong_password(curl, url, 300, main_auth_scheme);
-  if (res != CURLE_OK)
-      goto test_cleanup;
+  if(res != CURLE_OK)
+    goto test_cleanup;
   curl_easy_reset(curl);
 
   res = send_wrong_password(curl, url, 400, fallback_auth_scheme);
-  if (res != CURLE_OK)
-      goto test_cleanup;
+  if(res != CURLE_OK)
+    goto test_cleanup;
   curl_easy_reset(curl);
 
   res = send_right_password(curl, url, 500, fallback_auth_scheme);
-  if (res != CURLE_OK)
-      goto test_cleanup;
+  if(res != CURLE_OK)
+    goto test_cleanup;
   curl_easy_reset(curl);
 
 test_cleanup:
index 0e2e9f4a6a04e7806fc18dfb21eaf289f5f850ce..736222dc6353b2a66ce3a9bff676d10d8f60eb3d 100644 (file)
@@ -47,7 +47,7 @@ static size_t callback(char* ptr, size_t size, size_t nmemb, void* data)
   const size_t failure = (size * nmemb) ? 0 : 1;
 
   char *output = malloc(size * nmemb + 1);
-  if (!output) {
+  if(!output) {
     fprintf(stderr, "output, malloc() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     return failure;
@@ -60,25 +60,25 @@ static size_t callback(char* ptr, size_t size, size_t nmemb, void* data)
 
   /* Get socket being used for this easy handle, otherwise CURL_SOCKET_BAD */
   code = curl_easy_getinfo(easy[idx], CURLINFO_LASTSOCKET, &longdata);
-  if (CURLE_OK != code) {
+  if(CURLE_OK != code) {
     fprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
             "with code %d (%s)\n",
             __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
     res = TEST_ERR_MAJOR_BAD;
     return failure;
   }
-  if (longdata == -1L)
+  if(longdata == -1L)
     sock = CURL_SOCKET_BAD;
   else
     sock = (curl_socket_t)longdata;
 
-  if (sock != CURL_SOCKET_BAD) {
+  if(sock != CURL_SOCKET_BAD) {
     /* Track relationship between this easy handle and the socket. */
-    if (sockets[idx] == CURL_SOCKET_BAD) {
+    if(sockets[idx] == CURL_SOCKET_BAD) {
       /* An easy handle without previous socket, record the socket. */
       sockets[idx] = sock;
     }
-    else if (sock != sockets[idx]) {
+    else if(sock != sockets[idx]) {
       /* An easy handle with a socket different to previously
          tracked one, log and fail right away. Known bug #37. */
       fprintf(stderr, "Handle %d started on socket %d and moved to %d\n",
@@ -113,7 +113,7 @@ int test(char *url)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  for (i = 0; i < MAX_EASY_HANDLES; ++i) {
+  for(i = 0; i < MAX_EASY_HANDLES; ++i) {
     easy[i] = NULL;
     sockets[i] = CURL_SOCKET_BAD;
   }
@@ -148,7 +148,8 @@ int test(char *url)
       if(num_handles % 3 == 2) {
         snprintf(full_url, urllen, "%s0200", url);
         easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
-      } else {
+      }
+      else {
         snprintf(full_url, urllen, "%s0100", url);
         easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
       }
@@ -182,7 +183,7 @@ int test(char *url)
     /* At this point, maxfd is guaranteed to be greater or equal than -1. */
 
     /* Any socket which is new in fdread is associated with the new handle */
-    for (i = 0; i <= maxfd; ++i) {
+    for(i = 0; i <= maxfd; ++i) {
       bool socket_exists = FALSE;
       curl_socket_t curfd = (curl_socket_t)i;
 
@@ -192,7 +193,7 @@ int test(char *url)
 
       /* Check if this socket was already detected for an earlier handle (or
          for this handle, num_handles-1, in the callback */
-      for (j = 0; j < num_handles; ++j) {
+      for(j = 0; j < num_handles; ++j) {
         if(sockets[j] == curfd) {
           socket_exists = TRUE;
           break;
index 4bf6dcfe203179dfa63b369a9bba969c750fdb06..6b699fc3acef71e9d371f3ea3254073a678cd3bb 100644 (file)
 #include "curl_printf.h"
 
 #define test_setopt(A,B,C) \
-  if((res = curl_easy_setopt((A),(B),(C))) != CURLE_OK) goto test_cleanup
+  if((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) goto test_cleanup
 
 #define test_multi_setopt(A,B,C) \
-  if((res = curl_multi_setopt((A),(B),(C))) != CURLE_OK) goto test_cleanup
+  if((res = curl_multi_setopt((A), (B), (C))) != CURLE_OK) goto test_cleanup
 
 extern char *libtest_arg2; /* set by first.c to the argv[2] or NULL */
 extern char *libtest_arg3; /* set by first.c to the argv[3] or NULL */
@@ -132,16 +132,16 @@ extern int unitfail;
 } WHILE_FALSE
 
 #define res_easy_init(A) \
-  exe_easy_init((A),(__FILE__),(__LINE__))
+  exe_easy_init((A), (__FILE__), (__LINE__))
 
 #define chk_easy_init(A,Y,Z) do { \
-  exe_easy_init((A),(Y),(Z));     \
+  exe_easy_init((A), (Y), (Z));   \
   if(res)                         \
     goto test_cleanup;            \
 } WHILE_FALSE
 
 #define easy_init(A) \
-  chk_easy_init((A),(__FILE__),(__LINE__))
+  chk_easy_init((A), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
@@ -153,70 +153,70 @@ extern int unitfail;
 } WHILE_FALSE
 
 #define res_multi_init(A) \
-  exe_multi_init((A),(__FILE__),(__LINE__))
+  exe_multi_init((A), (__FILE__), (__LINE__))
 
 #define chk_multi_init(A,Y,Z) do { \
-  exe_multi_init((A),(Y),(Z));     \
+  exe_multi_init((A), (Y), (Z));   \
   if(res)                          \
     goto test_cleanup;             \
 } WHILE_FALSE
 
 #define multi_init(A) \
-  chk_multi_init((A),(__FILE__),(__LINE__))
+  chk_multi_init((A), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
-#define exe_easy_setopt(A,B,C,Y,Z) do {                  \
-  CURLcode ec;                                           \
-  if((ec = curl_easy_setopt((A),(B),(C))) != CURLE_OK) { \
-    fprintf(stderr, "%s:%d curl_easy_setopt() failed, "  \
-            "with code %d (%s)\n",                       \
-            (Y), (Z), (int)ec, curl_easy_strerror(ec));  \
-    res = (int)ec;                                       \
-  }                                                      \
+#define exe_easy_setopt(A,B,C,Y,Z) do {                    \
+  CURLcode ec;                                             \
+  if((ec = curl_easy_setopt((A), (B), (C))) != CURLE_OK) { \
+    fprintf(stderr, "%s:%d curl_easy_setopt() failed, "    \
+            "with code %d (%s)\n",                         \
+            (Y), (Z), (int)ec, curl_easy_strerror(ec));    \
+    res = (int)ec;                                         \
+  }                                                        \
 } WHILE_FALSE
 
-#define res_easy_setopt(A,B,C) \
-  exe_easy_setopt((A),(B),(C),(__FILE__),(__LINE__))
+#define res_easy_setopt(A, B, C) \
+  exe_easy_setopt((A), (B), (C), (__FILE__), (__LINE__))
 
-#define chk_easy_setopt(A,B,C,Y,Z) do { \
-  exe_easy_setopt((A),(B),(C),(Y),(Z)); \
-  if(res)                               \
-    goto test_cleanup;                  \
+#define chk_easy_setopt(A, B, C, Y, Z) do { \
+  exe_easy_setopt((A), (B), (C), (Y), (Z)); \
+  if(res)                                   \
+    goto test_cleanup;                      \
 } WHILE_FALSE
 
-#define easy_setopt(A,B,C) \
-  chk_easy_setopt((A),(B),(C),(__FILE__),(__LINE__))
+#define easy_setopt(A, B, C) \
+  chk_easy_setopt((A), (B), (C), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
-#define exe_multi_setopt(A,B,C,Y,Z) do {                  \
-  CURLMcode ec;                                           \
-  if((ec = curl_multi_setopt((A),(B),(C))) != CURLM_OK) { \
-    fprintf(stderr, "%s:%d curl_multi_setopt() failed, "  \
-            "with code %d (%s)\n",                        \
-            (Y), (Z), (int)ec, curl_multi_strerror(ec));  \
-    res = (int)ec;                                        \
-  }                                                       \
+#define exe_multi_setopt(A, B, C, Y, Z) do {                \
+  CURLMcode ec;                                             \
+  if((ec = curl_multi_setopt((A), (B), (C))) != CURLM_OK) { \
+    fprintf(stderr, "%s:%d curl_multi_setopt() failed, "    \
+            "with code %d (%s)\n",                          \
+            (Y), (Z), (int)ec, curl_multi_strerror(ec));    \
+    res = (int)ec;                                          \
+  }                                                         \
 } WHILE_FALSE
 
 #define res_multi_setopt(A,B,C) \
-  exe_multi_setopt((A),(B),(C),(__FILE__),(__LINE__))
+  exe_multi_setopt((A), (B), (C), (__FILE__), (__LINE__))
 
-#define chk_multi_setopt(A,B,C,Y,Z) do { \
-  exe_multi_setopt((A),(B),(C),(Y),(Z)); \
-  if(res)                                \
-    goto test_cleanup;                   \
+#define chk_multi_setopt(A,B,C,Y,Z) do {     \
+  exe_multi_setopt((A), (B), (C), (Y), (Z)); \
+  if(res)                                    \
+    goto test_cleanup;                       \
 } WHILE_FALSE
 
 #define multi_setopt(A,B,C) \
-  chk_multi_setopt((A),(B),(C),(__FILE__),(__LINE__))
+  chk_multi_setopt((A), (B), (C), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
 #define exe_multi_add_handle(A,B,Y,Z) do {                   \
   CURLMcode ec;                                              \
-  if((ec = curl_multi_add_handle((A),(B))) != CURLM_OK) {    \
+  if((ec = curl_multi_add_handle((A), (B))) != CURLM_OK) {   \
     fprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \
             "with code %d (%s)\n",                           \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));     \
@@ -224,23 +224,23 @@ extern int unitfail;
   }                                                          \
 } WHILE_FALSE
 
-#define res_multi_add_handle(A,B) \
-  exe_multi_add_handle((A),(B),(__FILE__),(__LINE__))
+#define res_multi_add_handle(A, B) \
+  exe_multi_add_handle((A), (B), (__FILE__), (__LINE__))
 
-#define chk_multi_add_handle(A,B,Y,Z) do { \
-  exe_multi_add_handle((A),(B),(Y),(Z));   \
-  if(res)                                  \
-    goto test_cleanup;                     \
+#define chk_multi_add_handle(A, B, Y, Z) do { \
+  exe_multi_add_handle((A), (B), (Y), (Z));   \
+  if(res)                                     \
+    goto test_cleanup;                        \
 } WHILE_FALSE
 
-#define multi_add_handle(A,B) \
-  chk_multi_add_handle((A),(B),(__FILE__),(__LINE__))
+#define multi_add_handle(A, B) \
+  chk_multi_add_handle((A), (B), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
 #define exe_multi_remove_handle(A,B,Y,Z) do {                   \
   CURLMcode ec;                                                 \
-  if((ec = curl_multi_remove_handle((A),(B))) != CURLM_OK) {    \
+  if((ec = curl_multi_remove_handle((A), (B))) != CURLM_OK) {   \
     fprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \
             "with code %d (%s)\n",                              \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));        \
@@ -248,24 +248,24 @@ extern int unitfail;
   }                                                             \
 } WHILE_FALSE
 
-#define res_multi_remove_handle(A,B) \
-  exe_multi_remove_handle((A),(B),(__FILE__),(__LINE__))
+#define res_multi_remove_handle(A, B) \
+  exe_multi_remove_handle((A), (B), (__FILE__), (__LINE__))
 
-#define chk_multi_remove_handle(A,B,Y,Z) do { \
-  exe_multi_remove_handle((A),(B),(Y),(Z));   \
-  if(res)                                     \
-    goto test_cleanup;                        \
+#define chk_multi_remove_handle(A, B, Y, Z) do { \
+  exe_multi_remove_handle((A), (B), (Y), (Z));   \
+  if(res)                                        \
+    goto test_cleanup;                           \
 } WHILE_FALSE
 
 
-#define multi_remove_handle(A,B) \
-  chk_multi_remove_handle((A),(B),(__FILE__),(__LINE__))
+#define multi_remove_handle(A, B) \
+  chk_multi_remove_handle((A), (B), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
 #define exe_multi_perform(A,B,Y,Z) do {                          \
   CURLMcode ec;                                                  \
-  if((ec = curl_multi_perform((A),(B))) != CURLM_OK) {           \
+  if((ec = curl_multi_perform((A), (B))) != CURLM_OK) {          \
     fprintf(stderr, "%s:%d curl_multi_perform() failed, "        \
             "with code %d (%s)\n",                               \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));         \
@@ -279,53 +279,53 @@ extern int unitfail;
   }                                                              \
 } WHILE_FALSE
 
-#define res_multi_perform(A,B) \
-  exe_multi_perform((A),(B),(__FILE__),(__LINE__))
+#define res_multi_perform(A, B) \
+  exe_multi_perform((A), (B), (__FILE__), (__LINE__))
 
-#define chk_multi_perform(A,B,Y,Z) do { \
-  exe_multi_perform((A),(B),(Y),(Z));   \
-  if(res)                               \
-    goto test_cleanup;                  \
+#define chk_multi_perform(A, B, Y, Z) do { \
+  exe_multi_perform((A), (B), (Y), (Z));   \
+  if(res)                                  \
+    goto test_cleanup;                     \
 } WHILE_FALSE
 
 #define multi_perform(A,B) \
-  chk_multi_perform((A),(B),(__FILE__),(__LINE__))
+  chk_multi_perform((A), (B), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
-#define exe_multi_fdset(A,B,C,D,E,Y,Z) do {                      \
-  CURLMcode ec;                                                  \
-  if((ec = curl_multi_fdset((A),(B),(C),(D),(E))) != CURLM_OK) { \
-    fprintf(stderr, "%s:%d curl_multi_fdset() failed, "          \
-            "with code %d (%s)\n",                               \
-            (Y), (Z), (int)ec, curl_multi_strerror(ec));         \
-    res = (int)ec;                                               \
-  }                                                              \
-  else if(*((E)) < -1) {                                         \
-    fprintf(stderr, "%s:%d curl_multi_fdset() succeeded, "       \
-            "but returned invalid max_fd value (%d)\n",          \
-            (Y), (Z), (int)*((E)));                              \
-    res = TEST_ERR_NUM_HANDLES;                                  \
-  }                                                              \
+#define exe_multi_fdset(A, B, C, D, E, Y, Z) do {                    \
+  CURLMcode ec;                                                      \
+  if((ec = curl_multi_fdset((A), (B), (C), (D), (E))) != CURLM_OK) { \
+    fprintf(stderr, "%s:%d curl_multi_fdset() failed, "              \
+            "with code %d (%s)\n",                                   \
+            (Y), (Z), (int)ec, curl_multi_strerror(ec));             \
+    res = (int)ec;                                                   \
+  }                                                                  \
+  else if(*((E)) < -1) {                                             \
+    fprintf(stderr, "%s:%d curl_multi_fdset() succeeded, "           \
+            "but returned invalid max_fd value (%d)\n",              \
+            (Y), (Z), (int)*((E)));                                  \
+    res = TEST_ERR_NUM_HANDLES;                                      \
+  }                                                                  \
 } WHILE_FALSE
 
-#define res_multi_fdset(A,B,C,D,E) \
-  exe_multi_fdset((A),(B),(C),(D),(E),(__FILE__),(__LINE__))
+#define res_multi_fdset(A, B, C, D, E) \
+  exe_multi_fdset((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
 
-#define chk_multi_fdset(A,B,C,D,E,Y,Z) do {     \
-  exe_multi_fdset((A),(B),(C),(D),(E),(Y),(Z)); \
-  if(res)                                       \
-    goto test_cleanup;                          \
-} WHILE_FALSE
+#define chk_multi_fdset(A, B, C, D, E, Y, Z) do {       \
+    exe_multi_fdset((A), (B), (C), (D), (E), (Y), (Z)); \
+    if(res)                                             \
+      goto test_cleanup;                                \
+  } WHILE_FALSE
 
-#define multi_fdset(A,B,C,D,E) \
-  chk_multi_fdset((A),(B),(C),(D),(E),(__FILE__),(__LINE__))
+#define multi_fdset(A, B, C, D, E) \
+  chk_multi_fdset((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
 #define exe_multi_timeout(A,B,Y,Z) do {                      \
   CURLMcode ec;                                              \
-  if((ec = curl_multi_timeout((A),(B))) != CURLM_OK) {       \
+  if((ec = curl_multi_timeout((A), (B))) != CURLM_OK) {      \
     fprintf(stderr, "%s:%d curl_multi_timeout() failed, "    \
             "with code %d (%s)\n",                           \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));     \
@@ -339,42 +339,42 @@ extern int unitfail;
   }                                                          \
 } WHILE_FALSE
 
-#define res_multi_timeout(A,B) \
-  exe_multi_timeout((A),(B),(__FILE__),(__LINE__))
+#define res_multi_timeout(A, B) \
+  exe_multi_timeout((A), (B), (__FILE__), (__LINE__))
 
-#define chk_multi_timeout(A,B,Y,Z) do { \
-  exe_multi_timeout((A),(B),(Y),(Z));   \
-  if(res)                               \
-    goto test_cleanup;                  \
-} WHILE_FALSE
+#define chk_multi_timeout(A, B, Y, Z) do { \
+    exe_multi_timeout((A), (B), (Y), (Z)); \
+    if(res)                                \
+      goto test_cleanup;                   \
+  } WHILE_FALSE
 
-#define multi_timeout(A,B) \
-  chk_multi_timeout((A),(B),(__FILE__),(__LINE__))
+#define multi_timeout(A, B) \
+  chk_multi_timeout((A), (B), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
-#define exe_select_test(A,B,C,D,E,Y,Z) do {        \
-  int ec;                                          \
-  if(select_wrapper((A),(B),(C),(D),(E)) == -1 ) { \
-    ec = SOCKERRNO;                                \
-    fprintf(stderr, "%s:%d select() failed, with " \
-            "errno %d (%s)\n",                     \
-            (Y), (Z), ec, strerror(ec));           \
-    res = TEST_ERR_SELECT;                         \
-  }                                                \
-} WHILE_FALSE
-
-#define res_select_test(A,B,C,D,E) \
-  exe_select_test((A),(B),(C),(D),(E),(__FILE__),(__LINE__))
-
-#define chk_select_test(A,B,C,D,E,Y,Z) do {     \
-  exe_select_test((A),(B),(C),(D),(E),(Y),(Z)); \
-  if(res)                                       \
-    goto test_cleanup;                          \
-} WHILE_FALSE
-
-#define select_test(A,B,C,D,E) \
-  chk_select_test((A),(B),(C),(D),(E),(__FILE__),(__LINE__))
+#define exe_select_test(A, B, C, D, E, Y, Z) do {               \
+    int ec;                                                     \
+    if(select_wrapper((A), (B), (C), (D), (E)) == -1 ) {        \
+      ec = SOCKERRNO;                                           \
+      fprintf(stderr, "%s:%d select() failed, with "            \
+              "errno %d (%s)\n",                                \
+              (Y), (Z), ec, strerror(ec));                      \
+      res = TEST_ERR_SELECT;                                    \
+    }                                                           \
+  } WHILE_FALSE
+
+#define res_select_test(A, B, C, D, E) \
+  exe_select_test((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
+
+#define chk_select_test(A, B, C, D, E, Y, Z) do {       \
+    exe_select_test((A), (B), (C), (D), (E), (Y), (Z)); \
+    if(res)                                             \
+      goto test_cleanup;                                \
+  } WHILE_FALSE
+
+#define select_test(A, B, C, D, E) \
+  chk_select_test((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
@@ -391,16 +391,16 @@ extern int unitfail;
 } WHILE_FALSE
 
 #define res_test_timedout() \
-  exe_test_timedout((__FILE__),(__LINE__))
+  exe_test_timedout((__FILE__), (__LINE__))
 
-#define chk_test_timedout(Y,Z) do { \
-  exe_test_timedout(Y,Z);           \
-  if(res)                           \
-    goto test_cleanup;              \
-} WHILE_FALSE
+#define chk_test_timedout(Y, Z) do { \
+    exe_test_timedout(Y, Z);         \
+    if(res)                          \
+      goto test_cleanup;             \
+  } WHILE_FALSE
 
 #define abort_on_test_timeout() \
-  chk_test_timedout((__FILE__),(__LINE__))
+  chk_test_timedout((__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */
 
@@ -415,18 +415,18 @@ extern int unitfail;
 } WHILE_FALSE
 
 #define res_global_init(A) \
-  exe_global_init((A),(__FILE__),(__LINE__))
+  exe_global_init((A), (__FILE__), (__LINE__))
 
-#define chk_global_init(A,Y,Z) do { \
-  exe_global_init((A),(Y),(Z));     \
-  if(res)                           \
-    return res;                     \
-} WHILE_FALSE
+#define chk_global_init(A, Y, Z) do { \
+    exe_global_init((A), (Y), (Z));   \
+    if(res)                           \
+      return res;                     \
+  } WHILE_FALSE
 
 /* global_init() is different than other macros. In case of
    failure it 'return's instead of going to 'test_cleanup'. */
 
 #define global_init(A) \
-  chk_global_init((A),(__FILE__),(__LINE__))
+  chk_global_init((A), (__FILE__), (__LINE__))
 
 /* ---------------------------------------------------------------- */