]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tidy-up: result code variable names in tests and examples
authorViktor Szakats <commit@vsz.me>
Thu, 13 Nov 2025 19:31:51 +0000 (20:31 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 14 Nov 2025 00:47:12 +0000 (01:47 +0100)
Sync outliers with the rest of the code.

Also:
- return error in some failed init cases, instead of `CURLE_OK`:
  1908, 1910, 1913, 2082, 3010
- lib1541: delete unused struct member.

Closes #19515

40 files changed:
docs/examples/sftpuploadresume.c
docs/examples/websocket-updown.c
tests/libtest/cli_h2_pausing.c
tests/libtest/cli_h2_serverpush.c
tests/libtest/cli_h2_upgrade_extreme.c
tests/libtest/cli_hx_download.c
tests/libtest/cli_hx_upload.c
tests/libtest/cli_tls_session_reuse.c
tests/libtest/cli_upload_pausing.c
tests/libtest/cli_ws_data.c
tests/libtest/cli_ws_pingpong.c
tests/libtest/first.c
tests/libtest/lib1156.c
tests/libtest/lib1485.c
tests/libtest/lib1523.c
tests/libtest/lib1541.c
tests/libtest/lib1568.c
tests/libtest/lib1908.c
tests/libtest/lib1910.c
tests/libtest/lib1911.c
tests/libtest/lib1913.c
tests/libtest/lib2082.c
tests/libtest/lib2301.c
tests/libtest/lib2304.c
tests/libtest/lib3010.c
tests/libtest/lib3207.c
tests/unit/unit1606.c
tests/unit/unit1651.c
tests/unit/unit1654.c
tests/unit/unit1656.c
tests/unit/unit1657.c
tests/unit/unit1658.c
tests/unit/unit1660.c
tests/unit/unit1661.c
tests/unit/unit2600.c
tests/unit/unit2601.c
tests/unit/unit2602.c
tests/unit/unit2604.c
tests/unit/unit2605.c
tests/unit/unit3200.c

index c15d103b5f0b7ae2086056f820a8f845121fd915..cb5d1cf33e0cb737f4fac4607e97395651243383 100644 (file)
@@ -53,7 +53,7 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
   CURL *curl = curl_easy_init();
 
   if(curl) {
-    CURLcode result;
+    CURLcode res;
 
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
 
@@ -63,12 +63,11 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
     curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
     curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
 
-    result = curl_easy_perform(curl);
-    if(CURLE_OK == result) {
-      result = curl_easy_getinfo(curl,
-                                 CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
-                                 &remoteFileSizeByte);
-      if(result)
+    res = curl_easy_perform(curl);
+    if(CURLE_OK == res) {
+      res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
+                              &remoteFileSizeByte);
+      if(res)
         return -1;
       printf("filesize: %" CURL_FORMAT_CURL_OFF_T "\n", remoteFileSizeByte);
     }
@@ -83,7 +82,7 @@ static int sftpResumeUpload(CURL *curl, const char *remotepath,
                             const char *localpath)
 {
   FILE *f = NULL;
-  CURLcode result = CURLE_GOT_NOTHING;
+  CURLcode res = CURLE_GOT_NOTHING;
 
   curl_off_t remoteFileSizeByte = sftpGetRemoteFileSize(remotepath);
   if(remoteFileSizeByte == -1) {
@@ -110,14 +109,14 @@ static int sftpResumeUpload(CURL *curl, const char *remotepath,
   fseek(f, (long)remoteFileSizeByte, SEEK_SET);
 #endif
   curl_easy_setopt(curl, CURLOPT_APPEND, 1L);
-  result = curl_easy_perform(curl);
+  res = curl_easy_perform(curl);
 
   fclose(f);
 
-  if(result == CURLE_OK)
+  if(res == CURLE_OK)
     return 1;
   else {
-    fprintf(stderr, "%s\n", curl_easy_strerror(result));
+    fprintf(stderr, "%s\n", curl_easy_strerror(res));
     return 0;
   }
 }
index 88d7b6e6e9f4884aa8abf2222410699d8d729cc6..87f7aea28752377f2475c6772542145fd5e6584c 100644 (file)
@@ -60,15 +60,14 @@ static size_t read_cb(char *buf, size_t nitems, size_t buflen, void *p)
   struct read_ctx *ctx = p;
   size_t len = nitems * buflen;
   size_t left = ctx->blen - ctx->nsent;
-  CURLcode result;
+  CURLcode res;
 
   if(!ctx->nsent) {
     /* On first call, set the FRAME information to be used (it defaults
      * to CURLWS_BINARY otherwise). */
-    result = curl_ws_start_frame(ctx->curl, CURLWS_TEXT,
-                                 (curl_off_t)ctx->blen);
-    if(result) {
-      fprintf(stderr, "error starting frame: %d\n", result);
+    res = curl_ws_start_frame(ctx->curl, CURLWS_TEXT, (curl_off_t)ctx->blen);
+    if(res) {
+      fprintf(stderr, "error starting frame: %d\n", res);
       return CURL_READFUNC_ABORT;
     }
   }
index 692b0a321103b1e02dd04c2c13e69a268ed15ff0..0f06dadd5204f64f6da94d0fd1ad2174c6b5d6e4 100644 (file)
@@ -88,7 +88,7 @@ static CURLcode test_cli_h2_pausing(const char *URL)
   size_t i;
   CURLMsg *msg;
   int rounds = 0;
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
   CURLU *cu;
   struct curl_slist *resolve = NULL;
   char resolve_buf[1024];
@@ -145,22 +145,22 @@ static CURLcode test_cli_h2_pausing(const char *URL)
   cu = curl_url();
   if(!cu) {
     curl_mfprintf(stderr, "out of memory\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   if(curl_url_set(cu, CURLUPART_URL, url, 0)) {
     curl_mfprintf(stderr, "not a URL: '%s'\n", url);
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) {
     curl_mfprintf(stderr, "could not get host of '%s'\n", url);
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) {
     curl_mfprintf(stderr, "could not get port of '%s'\n", url);
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   memset(&resolve, 0, sizeof(resolve));
@@ -192,7 +192,7 @@ static CURLcode test_cli_h2_pausing(const char *URL)
       curl_easy_setopt(handles[i].curl, CURLOPT_PIPEWAIT, 1L) != CURLE_OK ||
       curl_easy_setopt(handles[i].curl, CURLOPT_URL, url) != CURLE_OK) {
       curl_mfprintf(stderr, "failed configuring easy handle - bailing out\n");
-      result = (CURLcode)2;
+      res = (CURLcode)2;
       goto cleanup;
     }
     curl_easy_setopt(handles[i].curl, CURLOPT_HTTP_VERSION, http_version);
@@ -201,14 +201,14 @@ static CURLcode test_cli_h2_pausing(const char *URL)
   multi = curl_multi_init();
   if(!multi) {
     curl_mfprintf(stderr, "curl_multi_init() failed - bailing out\n");
-    result = (CURLcode)2;
+    res = (CURLcode)2;
     goto cleanup;
   }
 
   for(i = 0; i < CURL_ARRAYSIZE(handles); i++) {
     if(curl_multi_add_handle(multi, handles[i].curl) != CURLM_OK) {
       curl_mfprintf(stderr, "curl_multi_add_handle() failed - bailing out\n");
-      result = (CURLcode)2;
+      res = (CURLcode)2;
       goto cleanup;
     }
   }
@@ -217,7 +217,7 @@ static CURLcode test_cli_h2_pausing(const char *URL)
     curl_mfprintf(stderr, "INFO: multi_perform round %d\n", rounds);
     if(curl_multi_perform(multi, &still_running) != CURLM_OK) {
       curl_mfprintf(stderr, "curl_multi_perform() failed - bailing out\n");
-      result = (CURLcode)2;
+      res = (CURLcode)2;
       goto cleanup;
     }
 
@@ -247,14 +247,14 @@ static CURLcode test_cli_h2_pausing(const char *URL)
       if(!as_expected) {
         curl_mfprintf(stderr, "ERROR: handles not in expected state "
                       "after %d rounds\n", rounds);
-        result = (CURLcode)1;
+        res = (CURLcode)1;
       }
       break;
     }
 
     if(curl_multi_poll(multi, NULL, 0, 100, &numfds) != CURLM_OK) {
       curl_mfprintf(stderr, "curl_multi_poll() failed - bailing out\n");
-      result = (CURLcode)2;
+      res = (CURLcode)2;
       goto cleanup;
     }
 
@@ -268,7 +268,7 @@ static CURLcode test_cli_h2_pausing(const char *URL)
                             "resumed=%d, result %d - wtf?\n", i,
                             handles[i].paused,
                             handles[i].resumed, msg->data.result);
-              result = (CURLcode)1;
+              res = (CURLcode)1;
               goto cleanup;
             }
           }
@@ -314,5 +314,5 @@ cleanup:
   curl_multi_cleanup(multi);
   curl_global_cleanup();
 
-  return result;
+  return res;
 }
index 6936b3b0d65ce2dff3eb78c63578763b55119f64..ad3ae4f91406a7c4028dcd482773ab73cf24444d 100644 (file)
@@ -109,7 +109,7 @@ static CURLcode test_cli_h2_serverpush(const char *URL)
   CURL *curl = NULL;
   CURLM *multi;
   int transfers = 1; /* we start with one */
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
 
   debug_config.nohex = TRUE;
   debug_config.tracetime = FALSE;
@@ -126,19 +126,19 @@ static CURLcode test_cli_h2_serverpush(const char *URL)
 
   multi = curl_multi_init();
   if(!multi) {
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
 
   if(setup_h2_serverpush(curl, URL)) {
     curl_mfprintf(stderr, "failed\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
 
@@ -189,5 +189,5 @@ cleanup:
 
   curl_global_cleanup();
 
-  return result;
+  return res;
 }
index eb0549380031a50b2763a1612d679bfea9b3563d..b5c6c31b1b59426b46550b2605bad2d5617c2b23 100644 (file)
@@ -43,7 +43,7 @@ static CURLcode test_cli_h2_upgrade_extreme(const char *URL)
   CURLMsg *msg;
   int msgs_in_queue;
   char range[128];
-  CURLcode result = (CURLcode)1;
+  CURLcode res = (CURLcode)1;
 
   if(!URL) {
     curl_mfprintf(stderr, "need URL as argument\n");
@@ -149,7 +149,7 @@ static CURLcode test_cli_h2_upgrade_extreme(const char *URL)
   } while(running_handles > 0 || start_count);
 
   curl_mfprintf(stderr, "exiting\n");
-  result = CURLE_OK;
+  res = CURLE_OK;
 
 cleanup:
 
@@ -168,5 +168,5 @@ cleanup:
 
   curl_global_cleanup();
 
-  return result;
+  return res;
 }
index 365348455a005b26f795dba7136d5fdb03c2dbeb..f88a456a20bf2b5fd4844f81a505c9aa4be60f8c 100644 (file)
@@ -63,7 +63,7 @@ struct transfer_d {
   int resumed;
   int done;
   int checked_ssl;
-  CURLcode result;
+  CURLcode res;
 };
 
 static size_t transfer_count_d = 1;
@@ -296,7 +296,7 @@ static CURLcode test_cli_hx_download(const char *URL)
   size_t max_host_conns = 0;
   size_t max_total_conns = 0;
   int fresh_connect = 0;
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
 
   (void)URL;
 
@@ -307,7 +307,7 @@ static CURLcode test_cli_hx_download(const char *URL)
     switch(ch) {
     case 'h':
       usage_hx_download(NULL);
-      result = (CURLcode)2;
+      res = (CURLcode)2;
       goto optcleanup;
     case 'a':
       abort_paused = 1;
@@ -362,14 +362,14 @@ static CURLcode test_cli_hx_download(const char *URL)
         http_version = CURL_HTTP_VERSION_3ONLY;
       else {
         usage_hx_download("invalid http version");
-        result = (CURLcode)1;
+        res = (CURLcode)1;
         goto optcleanup;
       }
       break;
     }
     default:
       usage_hx_download("invalid option");
-      result = (CURLcode)1;
+      res = (CURLcode)1;
       goto optcleanup;
     }
   }
@@ -380,14 +380,14 @@ static CURLcode test_cli_hx_download(const char *URL)
 
   if(test_argc != 1) {
     usage_hx_download("not enough arguments");
-    result = (CURLcode)2;
+    res = (CURLcode)2;
     goto optcleanup;
   }
   url = test_argv[0];
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     curl_mfprintf(stderr, "curl_global_init() failed\n");
-    result = (CURLcode)3;
+    res = (CURLcode)3;
     goto optcleanup;
   }
 
@@ -397,7 +397,7 @@ static CURLcode test_cli_hx_download(const char *URL)
   share = curl_share_init();
   if(!share) {
     curl_mfprintf(stderr, "error allocating share\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
@@ -410,7 +410,7 @@ static CURLcode test_cli_hx_download(const char *URL)
   transfer_d = calloc(transfer_count_d, sizeof(*transfer_d));
   if(!transfer_d) {
     curl_mfprintf(stderr, "error allocating transfer structs\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
 
@@ -438,7 +438,7 @@ static CURLcode test_cli_hx_download(const char *URL)
        setup_hx_download(t->curl, url, t, http_version, host, share,
                          use_earlydata, fresh_connect)) {
       curl_mfprintf(stderr, "[t-%zu] FAILED setup\n", i);
-      result = (CURLcode)1;
+      res = (CURLcode)1;
       goto cleanup;
     }
     curl_multi_add_handle(multi, t->curl);
@@ -469,9 +469,9 @@ static CURLcode test_cli_hx_download(const char *URL)
         t = get_transfer_for_easy_d(easy);
         if(t) {
           t->done = 1;
-          t->result = m->data.result;
+          t->res = m->data.result;
           curl_mfprintf(stderr, "[t-%zu] FINISHED with result %d\n",
-                        t->idx, t->result);
+                        t->idx, t->res);
           if(use_earlydata) {
             curl_off_t sent;
             curl_easy_getinfo(easy, CURLINFO_EARLYDATA_SENT_T, &sent);
@@ -521,7 +521,7 @@ static CURLcode test_cli_hx_download(const char *URL)
               setup_hx_download(t->curl, url, t, http_version, host, share,
                                 use_earlydata, fresh_connect)) {
               curl_mfprintf(stderr, "[t-%zu] FAILED setup\n", i);
-              result = (CURLcode)1;
+              res = (CURLcode)1;
               goto cleanup;
             }
             curl_multi_add_handle(multi, t->curl);
@@ -554,8 +554,8 @@ cleanup:
         curl_easy_cleanup(t->curl);
         t->curl = NULL;
       }
-      if(t->result)
-        result = t->result;
+      if(t->res)
+        res = t->res;
       else /* on success we expect ssl to have been checked */
         assert(t->checked_ssl);
     }
@@ -571,5 +571,5 @@ optcleanup:
 
   free(resolve);
 
-  return result;
+  return res;
 }
index dc053ae755bdbb21b1080d5ee1ab50144f2e6df2..9ce955bba6c5b890ba5f7d927c95b21d664b5c76 100644 (file)
@@ -246,7 +246,7 @@ static CURLcode test_cli_hx_upload(const char *URL)
   struct curl_slist *host = NULL;
   const char *resolve = NULL;
   int ch;
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
 
   (void)URL;
 
@@ -348,7 +348,7 @@ static CURLcode test_cli_hx_upload(const char *URL)
   share = curl_share_init();
   if(!share) {
     curl_mfprintf(stderr, "error allocating share\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
@@ -361,7 +361,7 @@ static CURLcode test_cli_hx_upload(const char *URL)
   transfer_u = calloc(transfer_count_u, sizeof(*transfer_u));
   if(!transfer_u) {
     curl_mfprintf(stderr, "error allocating transfer structs\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
 
@@ -380,7 +380,7 @@ static CURLcode test_cli_hx_upload(const char *URL)
     CURL *curl = curl_easy_init();
     if(!curl) {
       curl_mfprintf(stderr, "failed to init easy handle\n");
-      result = (CURLcode)1;
+      res = (CURLcode)1;
       goto cleanup;
     }
     for(i = 0; i < transfer_count_u; ++i) {
@@ -390,7 +390,7 @@ static CURLcode test_cli_hx_upload(const char *URL)
       if(setup_hx_upload(t->curl, url, t, http_version, host, share,
                          use_earlydata, announce_length)) {
         curl_mfprintf(stderr, "[t-%zu] FAILED setup\n", i);
-        result = (CURLcode)1;
+        res = (CURLcode)1;
         goto cleanup;
       }
 
@@ -413,7 +413,7 @@ static CURLcode test_cli_hx_upload(const char *URL)
       if(!t->curl || setup_hx_upload(t->curl, url, t, http_version, host,
                                      share, use_earlydata, announce_length)) {
         curl_mfprintf(stderr, "[t-%zu] FAILED setup\n", i);
-        result = (CURLcode)1;
+        res = (CURLcode)1;
         goto cleanup;
       }
       curl_multi_add_handle(multi, t->curl);
@@ -500,7 +500,7 @@ static CURLcode test_cli_hx_upload(const char *URL)
                                              host, share, use_earlydata,
                                              announce_length)) {
                 curl_mfprintf(stderr, "[t-%zu] FAILED setup\n", i);
-                result = (CURLcode)1;
+                res = (CURLcode)1;
                 goto cleanup;
               }
               curl_multi_add_handle(multi, t->curl);
@@ -546,5 +546,5 @@ cleanup:
   curl_slist_free_all(host);
   curl_global_cleanup();
 
-  return result;
+  return res;
 }
index 2a6c0ea3bfab00ff1f639e1a67988c9ee90bac0e..2f6bde43e3846b63af7ec5dd9c53cb3d1ccf7c32 100644 (file)
@@ -109,7 +109,7 @@ static CURLcode test_cli_tls_session_reuse(const char *URL)
   int add_more, waits, ongoing = 0;
   char *host = NULL, *port = NULL;
   long http_version = CURL_HTTP_VERSION_1_1;
-  CURLcode result = (CURLcode)1;
+  CURLcode res = (CURLcode)1;
 
   if(!URL || !libtest_arg2) {
     curl_mfprintf(stderr, "need args: URL proto\n");
@@ -129,7 +129,7 @@ static CURLcode test_cli_tls_session_reuse(const char *URL)
   cu = curl_url();
   if(!cu) {
     curl_mfprintf(stderr, "out of memory\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   if(curl_url_set(cu, CURLUPART_URL, URL, 0)) {
@@ -236,12 +236,12 @@ static CURLcode test_cli_tls_session_reuse(const char *URL)
 
   if(!tse_found_tls_session) {
     curl_mfprintf(stderr, "CURLINFO_TLS_SSL_PTR not found during run\n");
-    result = CURLE_FAILED_INIT;
+    res = CURLE_FAILED_INIT;
     goto cleanup;
   }
 
   curl_mfprintf(stderr, "exiting\n");
-  result = CURLE_OK;
+  res = CURLE_OK;
 
 cleanup:
 
@@ -265,5 +265,5 @@ cleanup:
     curl_url_cleanup(cu);
   curl_global_cleanup();
 
-  return result;
+  return res;
 }
index 971157c3138a9cb5160c5d38dab331c31f73b2b7..441ce899a09e8d045b7db7cc6c3043c84648cdca 100644 (file)
@@ -86,7 +86,7 @@ static void usage_upload_pausing(const char *msg)
 static CURLcode test_cli_upload_pausing(const char *URL)
 {
   CURL *curl = NULL;
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
   CURLU *cu;
   struct curl_slist *resolve = NULL;
   char resolve_buf[1024];
@@ -136,22 +136,22 @@ static CURLcode test_cli_upload_pausing(const char *URL)
   cu = curl_url();
   if(!cu) {
     curl_mfprintf(stderr, "out of memory\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   if(curl_url_set(cu, CURLUPART_URL, url, 0)) {
     curl_mfprintf(stderr, "not a URL: '%s'\n", url);
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) {
     curl_mfprintf(stderr, "could not get host of '%s'\n", url);
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) {
     curl_mfprintf(stderr, "could not get port of '%s'\n", url);
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   memset(&resolve, 0, sizeof(resolve));
@@ -162,7 +162,7 @@ static CURLcode test_cli_upload_pausing(const char *URL)
   curl = curl_easy_init();
   if(!curl) {
     curl_mfprintf(stderr, "out of memory\n");
-    result = (CURLcode)1;
+    res = (CURLcode)1;
     goto cleanup;
   }
   /* We want to use our own read function. */
@@ -190,14 +190,14 @@ static CURLcode test_cli_upload_pausing(const char *URL)
      curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, cli_debug_cb) != CURLE_OK ||
      curl_easy_setopt(curl, CURLOPT_RESOLVE, resolve) != CURLE_OK) {
     curl_mfprintf(stderr, "something unexpected went wrong - bailing out!\n");
-    result = (CURLcode)2;
+    res = (CURLcode)2;
     goto cleanup;
   }
 
   curl_easy_setopt(curl, CURLOPT_URL, url);
   curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, http_version);
 
-  result = curl_easy_perform(curl);
+  res = curl_easy_perform(curl);
 
 cleanup:
 
@@ -210,5 +210,5 @@ cleanup:
     curl_url_cleanup(cu);
   curl_global_cleanup();
 
-  return result;
+  return res;
 }
index 7e5479b74312927da5ee3a26f3ab811fc9b6db83..aa43bc6058ca9084af04a33c39cedbdbf6f3c822 100644 (file)
@@ -411,7 +411,7 @@ static void test_ws_data_usage(const char *msg)
 static CURLcode test_cli_ws_data(const char *URL)
 {
 #ifndef CURL_DISABLE_WEBSOCKETS
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
   const char *url;
   size_t plen_min = 0, plen_max = 0, count = 1;
   int ch, model = 2;
@@ -472,13 +472,13 @@ static CURLcode test_cli_ws_data(const char *URL)
   }
 
   if(model == 1)
-    result = test_ws_data_m1_echo(url, plen_min, plen_max);
+    res = test_ws_data_m1_echo(url, plen_min, plen_max);
   else
-    result = test_ws_data_m2_echo(url, count, plen_min, plen_max);
+    res = test_ws_data_m2_echo(url, count, plen_min, plen_max);
 
   curl_global_cleanup();
 
-  return result;
+  return res;
 
 #else /* !CURL_DISABLE_WEBSOCKETS */
   (void)URL;
index 995c1e3f7c40b3e748b6405db639c56fb32351e9..0a8e957aa4118cae8342feebc0e6bef6c7224049 100644 (file)
@@ -56,7 +56,7 @@ static CURLcode test_cli_ws_pingpong(const char *URL)
 {
 #ifndef CURL_DISABLE_WEBSOCKETS
   CURL *curl;
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
   const char *payload;
 
   if(!URL || !libtest_arg2) {
@@ -78,16 +78,16 @@ static CURLcode test_cli_ws_pingpong(const char *URL)
     curl_easy_setopt(curl, CURLOPT_USERAGENT, "ws-pingpong");
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
     curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
-    result = curl_easy_perform(curl);
-    curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", result);
-    if(result == CURLE_OK)
-      result = pingpong(curl, payload);
+    res = curl_easy_perform(curl);
+    curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", res);
+    if(res == CURLE_OK)
+      res = pingpong(curl, payload);
 
     /* always cleanup */
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return result;
+  return res;
 
 #else /* !CURL_DISABLE_WEBSOCKETS */
   (void)URL;
index ad1f92997111bcd03e3f4ae11bd16a3d32101c1e..7ab38a9fd852b1f9cea8f7577ce8fd13cb26326a 100644 (file)
@@ -163,11 +163,10 @@ char *hexdump(const unsigned char *buf, size_t len)
 CURLcode ws_send_ping(CURL *curl, const char *send_payload)
 {
   size_t sent;
-  CURLcode result = curl_ws_send(curl, send_payload, strlen(send_payload),
-                                 &sent, 0, CURLWS_PING);
-  curl_mfprintf(stderr, "ws: curl_ws_send returned %u, sent %zu\n",
-                result, sent);
-  return result;
+  CURLcode res = curl_ws_send(curl, send_payload, strlen(send_payload),
+                              &sent, 0, CURLWS_PING);
+  curl_mfprintf(stderr, "ws: curl_ws_send returned %u, sent %zu\n", res, sent);
+  return res;
 }
 
 CURLcode ws_recv_pong(CURL *curl, const char *expected_payload)
@@ -175,11 +174,11 @@ CURLcode ws_recv_pong(CURL *curl, const char *expected_payload)
   size_t rlen;
   const struct curl_ws_frame *meta;
   char buffer[256];
-  CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
-  if(result) {
+  CURLcode res = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
+  if(res) {
     curl_mfprintf(stderr, "ws: curl_ws_recv returned %u, received %zu\n",
-                  result, rlen);
-    return result;
+                  res, rlen);
+    return res;
   }
 
   if(!(meta->flags & CURLWS_PONG)) {
@@ -192,7 +191,7 @@ CURLcode ws_recv_pong(CURL *curl, const char *expected_payload)
   if(rlen == strlen(expected_payload) &&
      !memcmp(expected_payload, buffer, rlen)) {
     curl_mfprintf(stderr, "ws: got the same payload back\n");
-    return CURLE_OK;  /* lib2304 returned 'result' here. Intentional? */
+    return CURLE_OK;  /* lib2304 returned 'res' here. Intentional? */
   }
   curl_mfprintf(stderr, "ws: did NOT get the same payload back\n");
   return CURLE_RECV_ERROR;
@@ -202,9 +201,8 @@ CURLcode ws_recv_pong(CURL *curl, const char *expected_payload)
 void ws_close(CURL *curl)
 {
   size_t sent;
-  CURLcode result = curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE);
-  curl_mfprintf(stderr, "ws: curl_ws_send returned %u, sent %zu\n",
-                result, sent);
+  CURLcode res = curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE);
+  curl_mfprintf(stderr, "ws: curl_ws_send returned %u, sent %zu\n", res, sent);
 }
 #endif /* CURL_DISABLE_WEBSOCKETS */
 
@@ -212,7 +210,7 @@ void ws_close(CURL *curl)
 int main(int argc, const char **argv)
 {
   const char *URL = "";
-  CURLcode result;
+  CURLcode res;
   entry_func_t entry_func;
   const char *entry_name;
   const char *env;
@@ -279,8 +277,8 @@ int main(int argc, const char **argv)
       testnum = (int)num;
   }
 
-  result = entry_func(URL);
-  curl_mfprintf(stderr, "Test ended with result %d\n", result);
+  res = entry_func(URL);
+  curl_mfprintf(stderr, "Test ended with result %d\n", res);
 
 #ifdef _WIN32
   /* flush buffers of all streams regardless of mode */
@@ -289,5 +287,5 @@ int main(int argc, const char **argv)
 
   /* Regular program status codes are limited to 0..127 and 126 and 127 have
    * special meanings by the shell, so limit a normal return code to 125 */
-  return (int)result <= 125 ? (int)result : 125;
+  return (int)res <= 125 ? (int)res : 125;
 }
index 07f8e46a047388eaad99996f8fce776005ee9e4d..6ceb6894e78554b7648de91eadd555da7aef142d 100644 (file)
@@ -44,7 +44,7 @@
 
 struct testparams {
   unsigned int flags; /* ORed flags as above. */
-  CURLcode result; /* Code that should be returned by curl_easy_perform(). */
+  CURLcode res; /* Code that should be returned by curl_easy_perform(). */
 };
 
 static const struct testparams testparams[] = {
@@ -102,14 +102,14 @@ static int onetest(CURL *curl, const char *url, const struct testparams *p,
   test_setopt(curl, CURLOPT_FAILONERROR, (p->flags & F_FAIL) ? 1L : 0L);
   hasbody = 0;
   res = curl_easy_perform(curl);
-  if(res != p->result) {
+  if(res != p->res) {
     curl_mprintf("%zu: bad error code (%d): resume=%s, fail=%s, http416=%s, "
                  "content-range=%s, expected=%d\n", num, res,
                  (p->flags & F_RESUME) ? "yes": "no",
                  (p->flags & F_FAIL) ? "yes": "no",
                  (p->flags & F_HTTP416) ? "yes": "no",
                  (p->flags & F_CONTENTRANGE) ? "yes": "no",
-                 p->result);
+                 p->res);
     return 1;
   }
   if(hasbody && (p->flags & F_IGNOREBODY)) {
index 36be7cd1e83be61fa5bb9125ff9406d3edcf49d5..7fea83317c06d2178d1e4417eba3f8101367d728 100644 (file)
@@ -29,7 +29,7 @@ struct t1485_transfer_status {
   CURL *curl;
   curl_off_t out_len;
   size_t hd_line;
-  CURLcode result;
+  CURLcode res;
   int http_status;
 };
 
@@ -39,7 +39,7 @@ static size_t t1485_header_callback(char *ptr, size_t size, size_t nmemb,
   struct t1485_transfer_status *st = (struct t1485_transfer_status *)userp;
   const char *hd = ptr;
   size_t len = size * nmemb;
-  CURLcode result;
+  CURLcode res;
 
   (void)fwrite(ptr, size, nmemb, stdout);
   ++st->hd_line;
@@ -47,22 +47,22 @@ static size_t t1485_header_callback(char *ptr, size_t size, size_t nmemb,
     curl_off_t clen;
     long httpcode = 0;
     /* end of a response */
-    result = curl_easy_getinfo(st->curl, CURLINFO_RESPONSE_CODE, &httpcode);
+    res = curl_easy_getinfo(st->curl, CURLINFO_RESPONSE_CODE, &httpcode);
     curl_mfprintf(stderr, "header_callback, get status: %ld, %d\n",
-                  httpcode, result);
+                  httpcode, res);
     if(httpcode < 100 || httpcode >= 1000) {
       curl_mfprintf(stderr, "header_callback, invalid status: %ld, %d\n",
-                    httpcode, result);
+                    httpcode, res);
       return CURLE_WRITE_ERROR;
     }
     st->http_status = (int)httpcode;
     if(st->http_status >= 200 && st->http_status < 300) {
-      result = curl_easy_getinfo(st->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
-                                 &clen);
+      res = curl_easy_getinfo(st->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
+                              &clen);
       curl_mfprintf(stderr, "header_callback, info Content-Length: "
-                    "%" CURL_FORMAT_CURL_OFF_T ", %d\n", clen, result);
-      if(result) {
-        st->result = result;
+                    "%" CURL_FORMAT_CURL_OFF_T ", %d\n", clen, res);
+      if(res) {
+        st->res = res;
         return CURLE_WRITE_ERROR;
       }
       if(clen < 0) {
index 36bdce8e83bc4ddb72714796b15f7faceb0ed755..5c9a01a5eb1b35d5d9e07970a7d10b033ec899c5 100644 (file)
@@ -55,7 +55,7 @@ static CURLcode run(CURL *curl, long limit, long time)
 
 static CURLcode test_lib1523(const char *URL)
 {
-  CURLcode ret;
+  CURLcode res;
   CURL *curl;
   char buffer[CURL_ERROR_SIZE];
   curl_global_init(CURL_GLOBAL_ALL);
@@ -66,18 +66,18 @@ static CURLcode test_lib1523(const char *URL)
   curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
   curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, dload_progress_cb);
 
-  ret = run(curl, 1, 2);
-  if(ret)
-    curl_mfprintf(stderr, "error (%d) %s\n", ret, buffer);
+  res = run(curl, 1, 2);
+  if(res)
+    curl_mfprintf(stderr, "error (%d) %s\n", res, buffer);
 
-  ret = run(curl, 12000, 1);
-  if(ret != CURLE_OPERATION_TIMEDOUT)
-    curl_mfprintf(stderr, "error (%d) %s\n", ret, buffer);
+  res = run(curl, 12000, 1);
+  if(res != CURLE_OPERATION_TIMEDOUT)
+    curl_mfprintf(stderr, "error (%d) %s\n", res, buffer);
   else
-    ret = CURLE_OK;
+    res = CURLE_OK;
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return ret;
+  return res;
 }
index a2caaef8c3fc1790233f032f50d7e3f7e69ae1af..150fd2e30bc905f95eb63005cc1002ebb3c199b7 100644 (file)
@@ -29,7 +29,6 @@ struct t1541_transfer_status {
   CURL *curl;
   int hd_count;
   int bd_count;
-  CURLcode result;
 };
 
 #define KN(a)   a, #a
index a7c454edf754fba20938cef765fedfaf475754bc..89dd83480dadb9098d0145af7df2a6cacf6c6d59 100644 (file)
 
 static CURLcode test_lib1568(const char *URL)
 {
-  CURLcode ret = TEST_ERR_MAJOR_BAD;
+  CURLcode res = TEST_ERR_MAJOR_BAD;
   CURL *curl;
   curl_off_t port;
 
   if(curlx_str_number(&libtest_arg2, &port, 0xffff))
-    return ret;
+    return res;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
-    return ret;
+    return res;
 
   curl = curl_easy_init();
   curl_easy_setopt(curl, CURLOPT_URL, URL);
@@ -47,10 +47,10 @@ static CURLcode test_lib1568(const char *URL)
   curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
   curl_easy_setopt(curl, CURLOPT_PORT, (long)port);
 
-  ret = curl_easy_perform(curl);
+  res = curl_easy_perform(curl);
 
   curl_easy_cleanup(curl);
 
   curl_global_cleanup();
-  return ret;
+  return res;
 }
index 500120066ed29aa5a8c58066ad22eb01eb62a9f3..1613d03e019eb95cc538d37166de9a7d38d79e25 100644 (file)
@@ -27,7 +27,7 @@
 
 static CURLcode test_lib1908(const char *URL)
 {
-  CURLcode ret = CURLE_OK;
+  CURLcode res = TEST_ERR_MAJOR_BAD;
   CURL *curl;
   start_test_timing();
 
@@ -38,13 +38,13 @@ static CURLcode test_lib1908(const char *URL)
     curl_easy_setopt(curl, CURLOPT_URL, URL);
     curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
     curl_easy_setopt(curl, CURLOPT_ALTSVC, libtest_arg2);
-    ret = curl_easy_perform(curl);
+    res = curl_easy_perform(curl);
 
-    if(!ret) {
+    if(!res) {
       /* make a copy and check that this also has alt-svc activated */
       CURL *curldupe = curl_easy_duphandle(curl);
       if(curldupe) {
-        ret = curl_easy_perform(curldupe);
+        res = curl_easy_perform(curldupe);
         /* we close the second handle first, which makes it store the alt-svc
            file only to get overwritten when the next handle is closed! */
         curl_easy_cleanup(curldupe);
@@ -58,5 +58,5 @@ static CURLcode test_lib1908(const char *URL)
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return ret;
+  return res;
 }
index 425598bf8833eef4f5277730830c0f6cc29fd317..ebe86c12453c9298db37e3197e947df7bb463d1b 100644 (file)
@@ -27,7 +27,7 @@
 
 static CURLcode test_lib1910(const char *URL)
 {
-  CURLcode ret = CURLE_OK;
+  CURLcode res = TEST_ERR_MAJOR_BAD;
   CURL *curl;
   start_test_timing();
 
@@ -39,9 +39,9 @@ static CURLcode test_lib1910(const char *URL)
     curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
     curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
     curl_easy_setopt(curl, CURLOPT_USERPWD, "user\nname:pass\nword");
-    ret = curl_easy_perform(curl);
+    res = curl_easy_perform(curl);
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return ret;
+  return res;
 }
index 7add65ec48c60e65f7bc0231e0a62ee3778b0fe9..46c73ffb361d346d5f150158258917954f6ee060 100644 (file)
@@ -55,7 +55,7 @@ static CURLcode test_lib1911(const char *URL)
       o;
       o = curl_easy_option_next(o)) {
     if(o->type == CURLOT_STRING) {
-      CURLcode result;
+      CURLcode res;
       /*
        * Whitelist string options that are safe for abuse
        */
@@ -72,8 +72,8 @@ static CURLcode test_lib1911(const char *URL)
 
       /* This is a string. Make sure that passing in a string longer
          CURL_MAX_INPUT_LENGTH returns an error */
-      result = curl_easy_setopt(curl, o->id, testbuf);
-      switch(result) {
+      res = curl_easy_setopt(curl, o->id, testbuf);
+      switch(res) {
       case CURLE_BAD_FUNCTION_ARGUMENT: /* the most normal */
       case CURLE_UNKNOWN_OPTION: /* left out from the build */
       case CURLE_NOT_BUILT_IN: /* not supported */
@@ -82,7 +82,7 @@ static CURLcode test_lib1911(const char *URL)
       default:
         /* all other return codes are unexpected */
         curl_mfprintf(stderr, "curl_easy_setopt(%s...) returned %d\n",
-                      o->name, result);
+                      o->name, res);
         error++;
         break;
       }
index 94a319f0c745fc89e5760a5304f3cfe0bdbc542c..cea7a6c6ec81f435aad6ce115b118d527a2a8035 100644 (file)
@@ -27,7 +27,7 @@
 
 static CURLcode test_lib1913(const char *URL)
 {
-  CURLcode ret = CURLE_OK;
+  CURLcode res = TEST_ERR_MAJOR_BAD;
   CURL *curl;
   start_test_timing();
 
@@ -40,9 +40,9 @@ static CURLcode test_lib1913(const char *URL)
     if(libtest_arg2)
       /* test1914 sets this extra arg */
       curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
-    ret = curl_easy_perform(curl);
+    res = curl_easy_perform(curl);
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return ret;
+  return res;
 }
index 093eebda31545b6065e7ad254b608c9375ec0d3d..9e41d43b0dd7045dd1e47f26e4044468bf745d27 100644 (file)
@@ -53,10 +53,11 @@ static int prereq_callback(void *clientp,
 
 static CURLcode test_lib2082(const char *URL)  /* libprereq */
 {
-  struct prcs prereq_cb;
-  CURLcode ret = CURLE_OK;
+  CURLcode res = TEST_ERR_MAJOR_BAD;
   CURL *curl = NULL;
 
+  struct prcs prereq_cb;
+
   prereq_cb.prereq_retcode = CURL_PREREQFUNC_OK;
   prereq_cb.ipv6 = 0;
 
@@ -83,11 +84,11 @@ static CURLcode test_lib2082(const char *URL)  /* libprereq */
       curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
     }
 
-    ret = curl_easy_perform(curl);
-    if(ret) {
+    res = curl_easy_perform(curl);
+    if(res) {
       curl_mfprintf(stderr,
                     "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-                    __FILE__, __LINE__, ret, curl_easy_strerror(ret));
+                    __FILE__, __LINE__, res, curl_easy_strerror(res));
       goto test_cleanup;
     }
   }
@@ -96,5 +97,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return ret;
+  return res;
 }
index 40e357a3bafd5726770ca6fa7b6d7115567d8e55..6fb9e48618cbdddf7328b737e9c9fb3c314d8644 100644 (file)
@@ -57,10 +57,10 @@ static size_t t2301_write_cb(char *b, size_t size, size_t nitems, void *p)
   curl_mfprintf(stderr, "\n");
   (void)size;
   if(buffer[0] == 0x89) {
-    CURLcode result;
+    CURLcode res;
     curl_mfprintf(stderr, "send back a simple PONG\n");
-    result = curl_ws_send(curl, pong, 2, &sent, 0, 0);
-    if(result)
+    res = curl_ws_send(curl, pong, 2, &sent, 0, 0);
+    if(res)
       nitems = 0;
   }
   if(nitems != incoming)
index 4a2abe5f7b1dbed333481eaff71897ac3f0dc63f..cc86e76a10dc63621a37104d2a58362b87ad5587 100644 (file)
@@ -29,9 +29,9 @@ static CURLcode recv_any(CURL *curl)
   size_t rlen;
   const struct curl_ws_frame *meta;
   char buffer[256];
-  CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
-  if(result)
-    return result;
+  CURLcode res = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
+  if(res)
+    return res;
 
   curl_mfprintf(stderr, "recv_any: got %zu bytes rflags %x\n", rlen,
                 meta->flags);
index 58271772ab4bbde60c8f8a0affbc7420720c2d0a..4595f4de35772e0a08df32539e074deb6af4562e 100644 (file)
@@ -27,7 +27,7 @@
 
 static CURLcode test_lib3010(const char *URL)
 {
-  CURLcode ret = CURLE_OK;
+  CURLcode res = TEST_ERR_MAJOR_BAD;
   CURL *curl = NULL;
   curl_off_t retry_after;
   char *follow_url = NULL;
@@ -37,22 +37,22 @@ static CURLcode test_lib3010(const char *URL)
 
   if(curl) {
     curl_easy_setopt(curl, CURLOPT_URL, URL);
-    ret = curl_easy_perform(curl);
-    if(ret) {
+    res = curl_easy_perform(curl);
+    if(res) {
       curl_mfprintf(stderr,
                     "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-                    __FILE__, __LINE__, ret, curl_easy_strerror(ret));
+                    __FILE__, __LINE__, res, curl_easy_strerror(res));
       goto test_cleanup;
     }
     curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &follow_url);
     curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &retry_after);
     curl_mprintf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry_after);
     curl_easy_setopt(curl, CURLOPT_URL, follow_url);
-    ret = curl_easy_perform(curl);
-    if(ret) {
+    res = curl_easy_perform(curl);
+    if(res) {
       curl_mfprintf(stderr,
                     "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-                    __FILE__, __LINE__, ret, curl_easy_strerror(ret));
+                    __FILE__, __LINE__, res, curl_easy_strerror(res));
       goto test_cleanup;
     }
 
@@ -65,5 +65,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return ret;
+  return res;
 }
index 316258c86e936eab755f1e0a297dda0f54bcedfa..8ba88e4a66b6eaa5702fb343860499884737d904 100644 (file)
@@ -37,7 +37,7 @@
 struct Ctx {
   const char *URL;
   CURLSH *share;
-  CURLcode result;
+  CURLcode res;
   size_t thread_id;
   struct curl_slist *contents;
 };
@@ -109,7 +109,7 @@ static unsigned int test_thread(void *ptr)
   }
 
 test_cleanup:
-  ctx->result = res;
+  ctx->res = res;
   return 0;
 }
 
@@ -192,15 +192,15 @@ static CURLcode test_lib3207(const char *URL)
     ctx[i].share = share;
     ctx[i].URL = URL;
     ctx[i].thread_id = i;
-    ctx[i].result = CURLE_OK;
+    ctx[i].res = CURLE_OK;
     ctx[i].contents = NULL;
   }
 
   execute(share, ctx);
 
   for(i = 0; i < CURL_ARRAYSIZE(ctx); i++) {
-    if(ctx[i].result) {
-      res = ctx[i].result;
+    if(ctx[i].res) {
+      res = ctx[i].res;
     }
     else {
       struct curl_slist *item = ctx[i].contents;
index e39ecaecdc084e5c840b65221d08d8ce33198934..d323b5ce020b0357ba09bbd3b67f595d781f45bb 100644 (file)
@@ -53,7 +53,7 @@ static int runawhile(struct Curl_easy *easy,
 {
   int counter = 1;
   struct curltime now = {1, 0};
-  CURLcode result;
+  CURLcode res;
   int finaltime;
 
   curl_easy_setopt(easy, CURLOPT_LOW_SPEED_LIMIT, speed_limit);
@@ -63,8 +63,8 @@ static int runawhile(struct Curl_easy *easy,
   do {
     /* fake the current transfer speed */
     easy->progress.current_speed = speed;
-    result = Curl_speedcheck(easy, now);
-    if(result)
+    res = Curl_speedcheck(easy, now);
+    if(res)
       break;
     /* step the time */
     now.tv_sec = ++counter;
index a038caacbd7f350cc7ad4a15d97a0e8f1c5c5051..d3620d99f299b7afd9ec3d3ed011ba3c49dcc724 100644 (file)
@@ -340,7 +340,7 @@ static CURLcode test_unit1651(const char *arg)
   0x61, 0x54, 0x4A, 0x2B, 0xB7, 0x6A, 0x12, 0x08, 0xFB,
   };
 
-  CURLcode result;
+  CURLcode res;
   const char *beg = (const char *)&cert[0];
   const char *end = (const char *)&cert[sizeof(cert)];
   struct Curl_easy *data;
@@ -354,9 +354,9 @@ static CURLcode test_unit1651(const char *arg)
 
   data = curl_easy_init();
   if(data) {
-    result = Curl_extract_certinfo(data, 0, beg, end);
+    res = Curl_extract_certinfo(data, 0, beg, end);
 
-    fail_unless(result == CURLE_OK, "Curl_extract_certinfo returned error");
+    fail_unless(res == CURLE_OK, "Curl_extract_certinfo returned error");
 
     /* a poor man's fuzzing of some initial data to make sure nothing bad
        happens */
index 4fe2439907a12c68339f1420c00d960b2a681430..d2144fc214234237a4a0796e20a720d2db50b21c 100644 (file)
@@ -33,12 +33,12 @@ static CURLcode test_unit1654(const char *arg)
 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
   char outname[256];
   CURL *curl;
-  CURLcode result;
+  CURLcode res;
   struct altsvcinfo *asi = Curl_altsvc_init();
   abort_if(!asi, "Curl_altsvc_i");
-  result = Curl_altsvc_load(asi, arg);
-  if(result) {
-    fail_if(result, "Curl_altsvc_load");
+  res = Curl_altsvc_load(asi, arg);
+  if(res) {
+    fail_if(res, "Curl_altsvc_load");
     goto fail;
   }
   curl_global_init(CURL_GLOBAL_ALL);
@@ -50,88 +50,86 @@ static CURLcode test_unit1654(const char *arg)
   fail_unless(Curl_llist_count(&asi->list) == 4, "wrong number of entries");
   curl_msnprintf(outname, sizeof(outname), "%s-out", arg);
 
-  result = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
-                             ALPN_h1, "example.org", 8080);
-  fail_if(result, "Curl_altsvc_parse() failed!");
+  res = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
+                          ALPN_h1, "example.org", 8080);
+  fail_if(res, "Curl_altsvc_parse() failed!");
   fail_unless(Curl_llist_count(&asi->list) == 5, "wrong number of entries");
 
-  result = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n",
-                             ALPN_h1, "2.example.org", 8080);
-  fail_if(result, "Curl_altsvc_parse(2) failed!");
+  res = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n",
+                          ALPN_h1, "2.example.org", 8080);
+  fail_if(res, "Curl_altsvc_parse(2) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 6, "wrong number of entries");
 
-  result = Curl_altsvc_parse(curl, asi,
-                             "h2=\"example.com:8080\", "
-                             "h3=\"yesyes.com:8080\"\r\n",
-                             ALPN_h1, "3.example.org", 8080);
-  fail_if(result, "Curl_altsvc_parse(3) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\"example.com:8080\", "
+                          "h3=\"yesyes.com:8080\"\r\n",
+                          ALPN_h1, "3.example.org", 8080);
+  fail_if(res, "Curl_altsvc_parse(3) failed!");
   /* that one should make two entries */
   fail_unless(Curl_llist_count(&asi->list) == 8, "wrong number of entries");
 
-  result = Curl_altsvc_parse(curl, asi,
-                             "h2=\"example.com:443\"; ma = 120;\r\n",
-                             ALPN_h2, "example.org", 80);
-  fail_if(result, "Curl_altsvc_parse(4) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\"example.com:443\"; ma = 120;\r\n",
+                          ALPN_h2, "example.org", 80);
+  fail_if(res, "Curl_altsvc_parse(4) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 9, "wrong number of entries");
 
   /* quoted 'ma' value */
-  result = Curl_altsvc_parse(curl, asi,
-                             "h2=\"example.net:443\"; ma=\"180\";\r\n",
-                             ALPN_h2, "example.net", 80);
-  fail_if(result, "Curl_altsvc_parse(5) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\"example.net:443\"; ma=\"180\";\r\n",
+                          ALPN_h2, "example.net", 80);
+  fail_if(res, "Curl_altsvc_parse(5) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
 
-  result =
-    Curl_altsvc_parse(curl, asi,
-                      "h2=\":443\", h3=\":443\"; "
-                      "persist = \"1\"; ma = 120;\r\n",
-                      ALPN_h1, "curl.se", 80);
-  fail_if(result, "Curl_altsvc_parse(6) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\":443\", h3=\":443\"; "
+                          "persist = \"1\"; ma = 120;\r\n",
+                          ALPN_h1, "curl.se", 80);
+  fail_if(res, "Curl_altsvc_parse(6) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries");
 
   /* clear that one again and decrease the counter */
-  result = Curl_altsvc_parse(curl, asi, "clear;\r\n",
-                             ALPN_h1, "curl.se", 80);
-  fail_if(result, "Curl_altsvc_parse(7) failed!");
+  res = Curl_altsvc_parse(curl, asi, "clear;\r\n",
+                          ALPN_h1, "curl.se", 80);
+  fail_if(res, "Curl_altsvc_parse(7) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
 
-  result =
-    Curl_altsvc_parse(curl, asi,
-                      "h2=\":443\", h3=\":443\"; "
-                      "persist = \"1\"; ma = 120;\r\n",
-                      ALPN_h1, "curl.se", 80);
-  fail_if(result, "Curl_altsvc_parse(6) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\":443\", h3=\":443\"; "
+                          "persist = \"1\"; ma = 120;\r\n",
+                          ALPN_h1, "curl.se", 80);
+  fail_if(res, "Curl_altsvc_parse(6) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries");
 
   /* clear - without semicolon */
-  result = Curl_altsvc_parse(curl, asi, "clear\r\n",
-                             ALPN_h1, "curl.se", 80);
-  fail_if(result, "Curl_altsvc_parse(7) failed!");
+  res = Curl_altsvc_parse(curl, asi, "clear\r\n",
+                          ALPN_h1, "curl.se", 80);
+  fail_if(res, "Curl_altsvc_parse(7) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
 
   /* only a non-existing alpn */
-  result = Curl_altsvc_parse(curl, asi,
-                             "h6=\"example.net:443\"; ma=\"180\";\r\n",
-                             ALPN_h2, "5.example.net", 80);
-  fail_if(result, "Curl_altsvc_parse(8) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h6=\"example.net:443\"; ma=\"180\";\r\n",
+                          ALPN_h2, "5.example.net", 80);
+  fail_if(res, "Curl_altsvc_parse(8) failed!");
 
   /* missing quote in alpn host */
-  result = Curl_altsvc_parse(curl, asi,
-                             "h2=\"example.net:443,; ma=\"180\";\r\n",
-                             ALPN_h2, "6.example.net", 80);
-  fail_if(result, "Curl_altsvc_parse(9) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\"example.net:443,; ma=\"180\";\r\n",
+                          ALPN_h2, "6.example.net", 80);
+  fail_if(res, "Curl_altsvc_parse(9) failed!");
 
   /* missing port in host name */
-  result = Curl_altsvc_parse(curl, asi,
-                             "h2=\"example.net\"; ma=\"180\";\r\n",
-                             ALPN_h2, "7.example.net", 80);
-  fail_if(result, "Curl_altsvc_parse(10) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\"example.net\"; ma=\"180\";\r\n",
+                          ALPN_h2, "7.example.net", 80);
+  fail_if(res, "Curl_altsvc_parse(10) failed!");
 
   /* illegal port in host name */
-  result = Curl_altsvc_parse(curl, asi,
-                             "h2=\"example.net:70000\"; ma=\"180\";\r\n",
-                             ALPN_h2, "8.example.net", 80);
-  fail_if(result, "Curl_altsvc_parse(11) failed!");
+  res = Curl_altsvc_parse(curl, asi,
+                          "h2=\"example.net:70000\"; ma=\"180\";\r\n",
+                          ALPN_h2, "8.example.net", 80);
+  fail_if(res, "Curl_altsvc_parse(11) failed!");
 
   Curl_altsvc_save(curl, asi, outname);
 
index 98e25b7c22a174b7ce892d77e50612f8fa6755e4..322aa2dbe32910e014415f291c63ecdd1d77128d 100644 (file)
 struct test_spec {
   const char *input;
   const char *exp_output;
-  CURLcode exp_result;
+  CURLcode exp_res;
 };
 
 static bool do_test(const struct test_spec *spec, size_t i,
                     struct dynbuf *dbuf)
 {
-  CURLcode result;
+  CURLcode res;
   const char *in = spec->input;
 
   curlx_dyn_reset(dbuf);
-  result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
-  if(result != spec->exp_result) {
+  res = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
+  if(res != spec->exp_res) {
     curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
-                  i, spec->exp_result, result);
+                  i, spec->exp_res, res);
     return FALSE;
   }
-  else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
+  else if(!res && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
     curl_mfprintf(stderr,
                   "test %zu: input '%s', expected output '%s', got '%s'\n",
                   i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
index 4898d6c13943e65eef107a1364cfc81eaedb356b..c03cd51f55a8a520ab727f05f19efd40f40f23e6 100644 (file)
@@ -30,7 +30,7 @@
 struct test1657_spec {
   CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
   size_t n;
-  CURLcode exp_result;
+  CURLcode exp_res;
 };
 
 static CURLcode make1657_nested(const struct test1657_spec *spec,
@@ -64,22 +64,22 @@ static const struct test1657_spec test1657_specs[] = {
 static bool do_test1657(const struct test1657_spec *spec, size_t i,
                         struct dynbuf *buf)
 {
-  CURLcode result;
+  CURLcode res;
   struct Curl_asn1Element elem;
   const char *in;
 
   memset(&elem, 0, sizeof(elem));
   curlx_dyn_reset(buf);
-  result = spec->setbuf(spec, buf);
-  if(result) {
-    curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, result);
+  res = spec->setbuf(spec, buf);
+  if(res) {
+    curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, res);
     return FALSE;
   }
   in = curlx_dyn_ptr(buf);
-  result = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
-  if(result != spec->exp_result) {
+  res = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
+  if(res != spec->exp_res) {
     curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
-                  i, spec->exp_result, result);
+                  i, spec->exp_res, res);
     return FALSE;
   }
   return TRUE;
index 6db104309287de40a119cf0a73c6c6b1655048e7..3273c2141aae61de22f596effaa30554692f6fea 100644 (file)
@@ -48,11 +48,11 @@ extern void doh_print_httpsrr(struct Curl_easy *data,
  */
 
 static char rrbuffer[256];
-static void rrresults(struct Curl_https_rrinfo *rr, CURLcode result)
+static void rrresults(struct Curl_https_rrinfo *rr, CURLcode res)
 {
   char *p = rrbuffer;
   char *pend = rrbuffer + sizeof(rrbuffer);
-  curl_msnprintf(rrbuffer, sizeof(rrbuffer), "r:%d|", (int)result);
+  curl_msnprintf(rrbuffer, sizeof(rrbuffer), "r:%d|", (int)res);
   p += strlen(rrbuffer);
 
   if(rr) {
@@ -502,7 +502,7 @@ static CURLcode test_unit1658(const char *arg)
     }
   };
 
-  CURLcode result = CURLE_OUT_OF_MEMORY;
+  CURLcode res = CURLE_OUT_OF_MEMORY;
   CURL *easy;
 
   easy = curl_easy_init();
@@ -516,10 +516,10 @@ static CURLcode test_unit1658(const char *arg)
 
       curl_mprintf("test %u: %s\n", i, t[i].name);
 
-      result = doh_resp_decode_httpsrr(easy, t[i].dns, t[i].len, &hrr);
+      res = doh_resp_decode_httpsrr(easy, t[i].dns, t[i].len, &hrr);
 
       /* create an output */
-      rrresults(hrr, result);
+      rrresults(hrr, res);
 
       /* is the output the expected? */
       if(strcmp(rrbuffer, t[i].expect)) {
index cbb78202150df1d8d61686269a550ae9620f0f16..376f6bdcfa451780aeeb9bc03a2ba185b4cae2f3 100644 (file)
@@ -54,7 +54,7 @@ static CURLcode test_unit1660(const char *arg)
     const char *host;
     const char *chost; /* if non-NULL, use to lookup with */
     const char *hdr; /* if NULL, just do the lookup */
-    const CURLcode result; /* parse result */
+    const CURLcode res; /* parse result */
   };
 
   static const struct testit headers[] = {
@@ -110,7 +110,7 @@ static CURLcode test_unit1660(const char *arg)
     { NULL, NULL, NULL, CURLE_OK }
   };
 
-  CURLcode result;
+  CURLcode res;
   struct stsentry *e;
   struct hsts *h = Curl_hsts_init();
   int i;
@@ -132,16 +132,16 @@ static CURLcode test_unit1660(const char *arg)
 
   for(i = 0; headers[i].host ; i++) {
     if(headers[i].hdr) {
-      result = Curl_hsts_parse(h, headers[i].host, headers[i].hdr);
+      res = Curl_hsts_parse(h, headers[i].host, headers[i].hdr);
 
-      if(result != headers[i].result) {
+      if(res != headers[i].res) {
         curl_mfprintf(stderr, "Curl_hsts_parse(%s) failed: %d\n",
-                      headers[i].hdr, result);
+                      headers[i].hdr, res);
         unitfail++;
         continue;
       }
-      else if(result) {
-        curl_mprintf("Input %u: error %d\n", i, (int) result);
+      else if(res) {
+        curl_mprintf("Input %u: error %d\n", i, (int)res);
         continue;
       }
     }
index 446ef51bda3e37701b3d3c20a6a93fab3809a42f..6cc448554401ae3ec616b6f9da176da720cf3c82 100644 (file)
@@ -52,7 +52,7 @@ static CURLcode test_unit1661(const char *arg)
   UNITTEST_BEGIN(t1661_setup(&bufref))
 
   const char *buffer = NULL;
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
 
   /**
    * testing Curl_bufref_init.
@@ -90,8 +90,8 @@ static CURLcode test_unit1661(const char *arg)
   /**
    * testing Curl_bufref_memdup
    */
-  result = Curl_bufref_memdup(&bufref, "1661", 3);
-  abort_unless(result == CURLE_OK, curl_easy_strerror(result));
+  res = Curl_bufref_memdup(&bufref, "1661", 3);
+  abort_unless(res == CURLE_OK, curl_easy_strerror(res));
   fail_unless(freecount == 1, "Destructor not called");
   fail_unless((const char *)bufref.ptr != buffer, "Returned pointer not set");
   buffer = (const char *)Curl_bufref_ptr(&bufref);
index fbf53c510791e82ecc2afbfcb3ac12fd14ad9238..6a03c438dcd96f94d79e75ae9c4f3acbff0b4165 100644 (file)
@@ -84,7 +84,7 @@ struct test_case {
   int exp_cf6_creations;
   timediff_t min_duration_ms;
   timediff_t max_duration_ms;
-  CURLcode exp_result;
+  CURLcode exp_res;
   const char *pref_family;
 };
 
@@ -96,7 +96,7 @@ struct ai_family_stats {
 };
 
 struct test_result {
-  CURLcode result;
+  CURLcode res;
   struct curltime started;
   struct curltime ended;
   struct ai_family_stats cf4;
@@ -189,13 +189,13 @@ static CURLcode cf_test_create(struct Curl_cfilter **pcf,
   struct cf_test_ctx *ctx = NULL;
   struct Curl_cfilter *cf = NULL;
   timediff_t created_at;
-  CURLcode result;
+  CURLcode res;
 
   (void)data;
   (void)conn;
   ctx = calloc(1, sizeof(*ctx));
   if(!ctx) {
-    result = CURLE_OUT_OF_MEMORY;
+    res = CURLE_OUT_OF_MEMORY;
     goto out;
   }
   ctx->idx = test_idx++;
@@ -224,19 +224,19 @@ static CURLcode cf_test_create(struct Curl_cfilter **pcf,
   ctx->stats->last_created = created_at;
   infof(data, "%04dms: cf[%s] created", (int)created_at, ctx->id);
 
-  result = Curl_cf_create(&cf, &cft_test, ctx);
-  if(result)
+  res = Curl_cf_create(&cf, &cft_test, ctx);
+  if(res)
     goto out;
 
   Curl_expire(data, ctx->fail_delay_ms, EXPIRE_TIMEOUT);
 
 out:
-  *pcf = (!result) ? cf : NULL;
-  if(result) {
+  *pcf = (!res) ? cf : NULL;
+  if(res) {
     free(cf);
     free(ctx);
   }
-  return result;
+  return res;
 }
 
 static void check_result(const struct test_case *tc,
@@ -248,12 +248,12 @@ static void check_result(const struct test_case *tc,
   duration_ms = curlx_timediff_ms(tr->ended, tr->started);
   curl_mfprintf(stderr, "%d: test case took %dms\n", tc->id, (int)duration_ms);
 
-  if(tr->result != tc->exp_result
-    && CURLE_OPERATION_TIMEDOUT != tr->result) {
+  if(tr->res != tc->exp_res
+    && CURLE_OPERATION_TIMEDOUT != tr->res) {
     /* on CI we encounter the TIMEOUT result, since images get less CPU
      * and events are not as sharply timed. */
     curl_msprintf(msg, "%d: expected result %d but got %d",
-                  tc->id, tc->exp_result, tr->result);
+                  tc->id, tc->exp_res, tr->res);
     fail(msg);
   }
   if(tr->cf4.creations != tc->exp_cf4_creations) {
@@ -326,7 +326,7 @@ static void test_connect(CURL *easy, const struct test_case *tc)
   tr.cf4.family = "v4";
 
   tr.started = curlx_now();
-  tr.result = curl_easy_perform(easy);
+  tr.res = curl_easy_perform(easy);
   tr.ended = curlx_now();
 
   curl_easy_setopt(easy, CURLOPT_RESOLVE, NULL);
index aadd69fc120476009d88cee2497927f0d1f69ca9..8411c19e9878de9ef9371b19ec1bf9e2d16f4395 100644 (file)
@@ -85,7 +85,7 @@ static void check_bufq(size_t pool_spares,
   struct bufq q;
   struct bufc_pool pool;
   size_t max_len = chunk_size * max_chunks;
-  CURLcode result;
+  CURLcode res;
   ssize_t i;
   size_t n2;
   size_t nwritten, nread;
@@ -105,20 +105,20 @@ static void check_bufq(size_t pool_spares,
   fail_unless(q.spare == NULL, "init: spare not NULL");
   fail_unless(Curl_bufq_len(&q) == 0, "init: bufq length != 0");
 
-  result = Curl_bufq_write(&q, test_data, wsize, &n2);
+  res = Curl_bufq_write(&q, test_data, wsize, &n2);
   fail_unless(n2 <= wsize, "write: wrong size returned");
-  fail_unless(result == CURLE_OK, "write: wrong result returned");
+  fail_unless(res == CURLE_OK, "write: wrong result returned");
 
   /* write empty bufq full */
   nwritten = 0;
   Curl_bufq_reset(&q);
   while(!Curl_bufq_is_full(&q)) {
-    result = Curl_bufq_write(&q, test_data, wsize, &n2);
-    if(!result) {
+    res = Curl_bufq_write(&q, test_data, wsize, &n2);
+    if(!res) {
       nwritten += n2;
     }
-    else if(result != CURLE_AGAIN) {
-      fail_unless(result == CURLE_AGAIN, "write-loop: unexpected result");
+    else if(res != CURLE_AGAIN) {
+      fail_unless(res == CURLE_AGAIN, "write-loop: unexpected result");
       break;
     }
   }
@@ -132,12 +132,12 @@ static void check_bufq(size_t pool_spares,
   /* read full bufq empty */
   nread = 0;
   while(!Curl_bufq_is_empty(&q)) {
-    result = Curl_bufq_read(&q, test_data, rsize, &n2);
-    if(!result) {
+    res = Curl_bufq_read(&q, test_data, rsize, &n2);
+    if(!res) {
       nread += n2;
     }
-    else if(result != CURLE_AGAIN) {
-      fail_unless(result == CURLE_AGAIN, "read-loop: unexpected result");
+    else if(res != CURLE_AGAIN) {
+      fail_unless(res == CURLE_AGAIN, "read-loop: unexpected result");
       break;
     }
   }
@@ -153,14 +153,14 @@ static void check_bufq(size_t pool_spares,
   }
 
   for(i = 0; i < 1000; ++i) {
-    result = Curl_bufq_write(&q, test_data, wsize, &n2);
-    if(result && result != CURLE_AGAIN) {
-      fail_unless(result == CURLE_AGAIN, "rw-loop: unexpected write result");
+    res = Curl_bufq_write(&q, test_data, wsize, &n2);
+    if(res && res != CURLE_AGAIN) {
+      fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected write result");
       break;
     }
-    result = Curl_bufq_read(&q, test_data, rsize, &n2);
-    if(result && result != CURLE_AGAIN) {
-      fail_unless(result == CURLE_AGAIN, "rw-loop: unexpected read result");
+    res = Curl_bufq_read(&q, test_data, rsize, &n2);
+    if(res && res != CURLE_AGAIN) {
+      fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected read result");
       break;
     }
   }
@@ -170,9 +170,9 @@ static void check_bufq(size_t pool_spares,
   Curl_bufq_init2(&q, chunk_size, max_chunks, (opts|BUFQ_OPT_SOFT_LIMIT));
   nwritten = 0;
   while(!Curl_bufq_is_full(&q)) {
-    result = Curl_bufq_write(&q, test_data, wsize, &n2);
-    if(result || n2 != wsize) {
-      fail_unless(!result && n2 == wsize, "write should be complete");
+    res = Curl_bufq_write(&q, test_data, wsize, &n2);
+    if(res || n2 != wsize) {
+      fail_unless(!res && n2 == wsize, "write should be complete");
       break;
     }
     nwritten += n2;
@@ -184,15 +184,15 @@ static void check_bufq(size_t pool_spares,
     fail_if(TRUE, "write: bufq full but nwritten wrong");
   }
   /* do one more write on a full bufq, should work */
-  result = Curl_bufq_write(&q, test_data, wsize, &n2);
-  fail_unless(!result && n2 == wsize, "write should be complete");
+  res = Curl_bufq_write(&q, test_data, wsize, &n2);
+  fail_unless(!res && n2 == wsize, "write should be complete");
   nwritten += n2;
   /* see that we get all out again */
   nread = 0;
   while(!Curl_bufq_is_empty(&q)) {
-    result = Curl_bufq_read(&q, test_data, rsize, &n2);
-    if(result) {
-      fail_unless(result, "read-loop: unexpected fail");
+    res = Curl_bufq_read(&q, test_data, rsize, &n2);
+    if(res) {
+      fail_unless(res, "read-loop: unexpected fail");
       break;
     }
     nread += n2;
@@ -211,12 +211,12 @@ static CURLcode test_unit2601(const char *arg)
 
   struct bufq q;
   size_t n;
-  CURLcode result;
+  CURLcode res;
   unsigned char buf[16*1024];
 
   Curl_bufq_init(&q, 8*1024, 12);
-  result = Curl_bufq_read(&q, buf, 128, &n);
-  fail_unless(result && result == CURLE_AGAIN, "read empty fail");
+  res = Curl_bufq_read(&q, buf, 128, &n);
+  fail_unless(res && res == CURLE_AGAIN, "read empty fail");
   Curl_bufq_free(&q);
 
   check_bufq(0, 1024, 4, 128, 128, BUFQ_OPT_NONE);
index f031132986cc2d8f95838f60f360f13db2d54723..da2b7dba549608491ea510d33f549fc8b9713bce 100644 (file)
@@ -33,7 +33,7 @@ static CURLcode test_unit2602(const char *arg)
 
   struct dynhds hds;
   struct dynbuf dbuf;
-  CURLcode result;
+  CURLcode res;
   size_t i;
 
   /* add 1 more header than allowed */
@@ -62,8 +62,8 @@ static CURLcode test_unit2602(const char *arg)
   }
   fail_unless(Curl_dynhds_count(&hds) == 2, "should hold 2");
   /* exceed limit on # of entries */
-  result = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
-  fail_unless(result, "add should have failed");
+  res = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
+  fail_unless(res, "add should have failed");
 
   fail_unless(Curl_dynhds_count_name(&hds, "test", 4) == 0, "false positive");
   fail_unless(Curl_dynhds_count_name(&hds, "test1", 4) == 0, "false positive");
@@ -94,9 +94,9 @@ static CURLcode test_unit2602(const char *arg)
   fail_unless(Curl_dynhds_cremove(&hds, "blablabla") == 2, "should");
   fail_if(Curl_dynhds_ccontains(&hds, "blablabla"), "should not");
 
-  result = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
-  fail_unless(result, "add should have failed");
-  if(!result) {
+  res = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
+  fail_unless(res, "add should have failed");
+  if(!res) {
     fail_unless(Curl_dynhds_ccount_name(&hds, "bLABlaBlA") == 0, "should");
     fail_if(Curl_dynhds_cadd(&hds, "Bla-Bla", "thingies"), "add failed");
 
@@ -113,8 +113,8 @@ static CURLcode test_unit2602(const char *arg)
   Curl_dynhds_free(&hds);
   Curl_dynhds_init(&hds, 128, 4*1024);
   /* continuation without previous header fails */
-  result = Curl_dynhds_h1_cadd_line(&hds, " indented value");
-  fail_unless(result, "add should have failed");
+  res = Curl_dynhds_h1_cadd_line(&hds, " indented value");
+  fail_unless(res, "add should have failed");
 
   /* continuation with previous header must succeed */
   fail_if(Curl_dynhds_h1_cadd_line(&hds, "ti1: val1"), "add");
index 13f7e80d8acbb15cbcb28ed489f48687d227ea5d..695b1210071ec6c00ebb7cadb5fe5b6acdf6d55b 100644 (file)
@@ -36,7 +36,7 @@ static CURLcode test_unit2604(const char *arg)
     const char *expect; /* the returned content */
     const char *next;   /* what cp points to after the call */
     const char *home;
-    CURLcode result;
+    CURLcode res;
   };
 
 #if defined(CURL_GNUC_DIAG) || defined(__clang__)
@@ -86,14 +86,14 @@ static CURLcode test_unit2604(const char *arg)
   for(i = 0; list[i].home; i++) {
     char *path;
     const char *cp = i == 0 ? cp0 : list[i].cp;
-    CURLcode result = Curl_get_pathname(&cp, &path, list[i].home);
+    CURLcode res = Curl_get_pathname(&cp, &path, list[i].home);
     curl_mprintf("%u - Curl_get_pathname(\"%s\", ... \"%s\") == %u\n", i,
-                 list[i].cp, list[i].home, list[i].result);
-    if(result != list[i].result) {
-      curl_mprintf("... returned %d\n", result);
+                 list[i].cp, list[i].home, list[i].res);
+    if(res != list[i].res) {
+      curl_mprintf("... returned %d\n", res);
       unitfail++;
     }
-    if(!result) {
+    if(!res) {
       if(cp && strcmp(cp, list[i].next)) {
         curl_mprintf("... cp points to '%s', not '%s' as expected \n",
                      cp, list[i].next);
index b94e87e78ceabddbfded532d0fc59e3f90f6a459..71c37f32cfcb2816673fe178a4f5c6a2093a96d3 100644 (file)
@@ -36,7 +36,7 @@ static CURLcode test_unit2605(const char *arg)
     curl_off_t filesize;
     curl_off_t start;
     curl_off_t size;
-    CURLcode result;
+    CURLcode res;
   };
 
   int i;
@@ -78,16 +78,16 @@ static CURLcode test_unit2605(const char *arg)
     for(i = 0; list[i].r; i++) {
       curl_off_t start;
       curl_off_t size;
-      CURLcode result;
+      CURLcode res;
       curl_mprintf("%u: '%s' (file size: %" FMT_OFF_T ")\n",
                    i, list[i].r, list[i].filesize);
-      result = Curl_ssh_range(curl, list[i].r, list[i].filesize,
-                              &start, &size);
-      if(result != list[i].result) {
-        curl_mprintf("... returned %d\n", result);
+      res = Curl_ssh_range(curl, list[i].r, list[i].filesize,
+                           &start, &size);
+      if(res != list[i].res) {
+        curl_mprintf("... returned %d\n", res);
         unitfail++;
       }
-      if(!result) {
+      if(!res) {
         if(start != list[i].start) {
           curl_mprintf("... start (%" FMT_OFF_T ") was not %" FMT_OFF_T " \n",
                        start, list[i].start);
index 15abba25db79fdb69f8775f04463822b18d925e9..0b3c87691157dba3b84b8d1f3da1cf0deb017786 100644 (file)
@@ -76,7 +76,7 @@ static CURLcode test_unit3200(const char *arg)
 #endif
 
   size_t i;
-  CURLcode result = CURLE_OK;
+  CURLcode res = CURLE_OK;
   for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) {
     FILE *fp;
     struct dynbuf buf;
@@ -96,62 +96,62 @@ static CURLcode test_unit3200(const char *arg)
     curl_mfprintf(stderr, "Test %zd...", i);
     switch(i) {
       case 0:
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE1\n", line),
+        fail_unless(!res && line && !strcmp("LINE1\n", line),
                     "First line failed (1)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE2 NEWLINE\n", line),
+        fail_unless(!res && line && !strcmp("LINE2 NEWLINE\n", line),
                     "Second line failed (1)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         abort_unless(eof, "Missed EOF (1)");
         break;
       case 1:
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE1\n", line),
+        fail_unless(!res && line && !strcmp("LINE1\n", line),
                     "First line failed (2)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE2 NONEWLINE\n", line),
+        fail_unless(!res && line && !strcmp("LINE2 NONEWLINE\n", line),
                     "Second line failed (2)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         abort_unless(eof, "Missed EOF (2)");
         break;
       case 2:
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE1\n", line),
+        fail_unless(!res && line && !strcmp("LINE1\n", line),
                     "First line failed (3)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         fail_unless(!curlx_dyn_len(&buf),
                     "Did not detect max read on EOF (3)");
         break;
       case 3:
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE1\n", line),
+        fail_unless(!res && line && !strcmp("LINE1\n", line),
                     "First line failed (4)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         fail_unless(!curlx_dyn_len(&buf),
                     "Did not ignore partial on EOF (4)");
         break;
       case 4:
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE1\n", line),
+        fail_unless(!res && line && !strcmp("LINE1\n", line),
                     "First line failed (5)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         fail_unless(!curlx_dyn_len(&buf),
                     "Did not bail out on too long line");
         break;
       case 5:
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         line = curlx_dyn_ptr(&buf);
-        fail_unless(!result && line && !strcmp("LINE1\x1aTEST\n", line),
+        fail_unless(!res && line && !strcmp("LINE1\x1aTEST\n", line),
                     "Missed/Misinterpreted ^Z (6)");
-        result = Curl_get_line(&buf, fp, &eof);
+        res = Curl_get_line(&buf, fp, &eof);
         abort_unless(eof, "Missed EOF (6)");
         break;
       default:
@@ -162,7 +162,7 @@ static CURLcode test_unit3200(const char *arg)
     curlx_fclose(fp);
     curl_mfprintf(stderr, "OK\n");
   }
-  return result;
+  return res;
 
 #endif