Imported Upstream version 7.50.2
[platform/upstream/curl.git] / tests / libtest / lib500.c
index e249d9f..43b0598 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);
       }
     }
   }