]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: rename more `CURLcode` variables to `result`
authorViktor Szakats <commit@vsz.me>
Sun, 25 Jan 2026 17:12:40 +0000 (18:12 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 26 Jan 2026 04:46:48 +0000 (05:46 +0100)
For consistency.

Also:
- one remaining in `src/tool_writeout.c`.
- replace casting an `int` to `CURLcode`.
- lib758: rename `CURLMcode` `result` to `mresult`.
- move literals to the right side of if expressions.

Follow-up to d0dc6e2ec059bf306f32e7a49e9ff7425cd26fcd #20426
Follow-up to 56f600ec23cab41fcced293ada81c8a30ac9cc87

Closes #20432

33 files changed:
src/tool_writeout.c
tests/libtest/cli_tls_session_reuse.c
tests/libtest/cli_ws_data.c
tests/libtest/lib1156.c
tests/libtest/lib1509.c
tests/libtest/lib1597.c
tests/libtest/lib1939.c
tests/libtest/lib2032.c
tests/libtest/lib3026.c
tests/libtest/lib3027.c
tests/libtest/lib512.c
tests/libtest/lib530.c
tests/libtest/lib586.c
tests/libtest/lib643.c
tests/libtest/lib678.c
tests/libtest/lib758.c
tests/server/getpart.c
tests/unit/unit1302.c
tests/unit/unit1305.c
tests/unit/unit1608.c
tests/unit/unit1620.c
tests/unit/unit1651.c
tests/unit/unit1654.c
tests/unit/unit1656.c
tests/unit/unit1657.c
tests/unit/unit1660.c
tests/unit/unit1663.c
tests/unit/unit2600.c
tests/unit/unit2601.c
tests/unit/unit2602.c
tests/unit/unit2603.c
tests/unit/unit2605.c
tests/unit/unit3200.c

index fd0224c32a3170a297801ea31449af8dec432a38..fbb8a4fb5eabdffafe7c008762631d047206a601 100644 (file)
@@ -163,8 +163,9 @@ static void certinfo(struct per_transfer *per)
 {
   if(!per->certinfo) {
     struct curl_certinfo *certinfo;
-    CURLcode res = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO, &certinfo);
-    per->certinfo = (!res && certinfo) ? certinfo : NULL;
+    CURLcode result = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO,
+                                        &certinfo);
+    per->certinfo = (!result && certinfo) ? certinfo : NULL;
   }
 }
 
index 5542e5f738d63c2c6e78509fbdd33b0c004bbced..82ce28c3feda1b0877ea8736ee50b3a16aeacc8d 100644 (file)
@@ -33,13 +33,13 @@ static size_t write_tse_cb(char *ptr, size_t size, size_t nmemb, void *opaque)
   (void)ptr;
   if(!tse_found_tls_session) {
     struct curl_tlssessioninfo *tlssession;
-    CURLcode rc;
+    CURLcode result;
 
-    rc = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &tlssession);
-    if(rc) {
+    result = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &tlssession);
+    if(result) {
       curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) "
-                    "failed: %s\n", curl_easy_strerror(rc));
-      return rc;
+                    "failed: %s\n", curl_easy_strerror(result));
+      return result;
     }
     if(tlssession->backend == CURLSSLBACKEND_NONE) {
       curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) "
index 1e5fd12afee9e3089d11da4bd962cd860f663858..57c8cebb1405669757a115476af821356ac43966 100644 (file)
@@ -74,7 +74,7 @@ static CURLcode test_ws_data_m2_echo(const char *url,
                                      size_t plen_max)
 {
   CURL *curl = NULL;
-  CURLcode r = CURLE_OK;
+  CURLcode result = CURLE_OK;
   const struct curl_ws_frame *frame;
   size_t len;
   char *send_buf = NULL, *recv_buf = NULL;
@@ -84,7 +84,7 @@ static CURLcode test_ws_data_m2_echo(const char *url,
   send_buf = curlx_calloc(1, plen_max + 1);
   recv_buf = curlx_calloc(1, plen_max + 1);
   if(!send_buf || !recv_buf) {
-    r = CURLE_OUT_OF_MEMORY;
+    result = CURLE_OUT_OF_MEMORY;
     goto out;
   }
   for(i = 0; i < plen_max; ++i) {
@@ -93,7 +93,7 @@ static CURLcode test_ws_data_m2_echo(const char *url,
 
   curl = curl_easy_init();
   if(!curl) {
-    r = CURLE_OUT_OF_MEMORY;
+    result = CURLE_OUT_OF_MEMORY;
     goto out;
   }
 
@@ -103,9 +103,9 @@ static CURLcode test_ws_data_m2_echo(const char *url,
   curl_easy_setopt(curl, CURLOPT_USERAGENT, "ws-data");
   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
   curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
-  r = curl_easy_perform(curl);
-  curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", r);
-  if(r != CURLE_OK)
+  result = curl_easy_perform(curl);
+  curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", result);
+  if(result != CURLE_OK)
     goto out;
 
   for(len = plen_min; len <= plen_max; ++len) {
@@ -116,12 +116,12 @@ static CURLcode test_ws_data_m2_echo(const char *url,
     while(slen || rlen || scount || rcount) {
       sblock = rblock = 1;
       if(slen) {
-        r = curl_ws_send(curl, sbuf, slen, &nwritten, 0, CURLWS_BINARY);
-        sblock = (r == CURLE_AGAIN);
-        if(!r || (r == CURLE_AGAIN)) {
+        result = curl_ws_send(curl, sbuf, slen, &nwritten, 0, CURLWS_BINARY);
+        sblock = (result == CURLE_AGAIN);
+        if(!result || (result == CURLE_AGAIN)) {
           curl_mfprintf(stderr, "curl_ws_send(len=%zu) -> %d, "
                         "%zu (%" CURL_FORMAT_CURL_OFF_T "/%zu)\n",
-                        slen, r, nwritten, (curl_off_t)(len - slen), len);
+                        slen, result, nwritten, (curl_off_t)(len - slen), len);
           sbuf += nwritten;
           slen -= nwritten;
         }
@@ -136,15 +136,15 @@ static CURLcode test_ws_data_m2_echo(const char *url,
 
       if(rlen) {
         size_t max_recv = (64 * 1024);
-        r = curl_ws_recv(curl, rbuf, (rlen > max_recv) ? max_recv : rlen,
-                         &nread, &frame);
-        if(!r || (r == CURLE_AGAIN)) {
-          rblock = (r == CURLE_AGAIN);
+        result = curl_ws_recv(curl, rbuf, (rlen > max_recv) ? max_recv : rlen,
+                              &nread, &frame);
+        if(!result || (result == CURLE_AGAIN)) {
+          rblock = (result == CURLE_AGAIN);
           curl_mfprintf(stderr, "curl_ws_recv(len=%zu) -> %d, %zu (%ld/%zu) "
-                        "\n", rlen, r, nread, (long)(len - rlen), len);
-          if(!r) {
-            r = test_ws_data_m2_check_recv(frame, len - rlen, nread, len);
-            if(r)
+                        "\n", rlen, result, nread, (long)(len - rlen), len);
+          if(!result) {
+            result = test_ws_data_m2_check_recv(frame, len - rlen, nread, len);
+            if(result)
               goto out;
           }
           rbuf += nread;
@@ -171,20 +171,20 @@ static CURLcode test_ws_data_m2_echo(const char *url,
                  (const unsigned char *)send_buf, len, FALSE);
       debug_dump("", "received:", stderr,
                  (const unsigned char *)recv_buf, len, FALSE);
-      r = CURLE_RECV_ERROR;
+      result = CURLE_RECV_ERROR;
       goto out;
     }
   }
 
 out:
   if(curl) {
-    if(!r)
+    if(!result)
       ws_close(curl);
     curl_easy_cleanup(curl);
   }
   curlx_free(send_buf);
   curlx_free(recv_buf);
-  return r;
+  return result;
 }
 
 struct test_ws_m1_ctx {
index d1cb07121881e8fbe854aee4a1865782afc23db7..fa75a6ae84b14c7e3535d6df6a6919ec5915a99d 100644 (file)
@@ -160,7 +160,7 @@ static CURLcode test_lib1156(const char *URL)
 
   curl_global_cleanup();
   curl_mprintf("%d\n", status);
-  return (CURLcode)status;
+  return status ? TEST_ERR_FAILURE : CURLE_OK;
 
 test_cleanup:
 
index 0119d4bfed1d0786b0da9dc7d0948d3cee336e3a..76b61206a5f1c5088dda08b2c3d77565cf0013ed 100644 (file)
@@ -63,7 +63,7 @@ static CURLcode test_lib1509(const char *URL)
   easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
 
   code = curl_easy_perform(curl);
-  if(CURLE_OK != code) {
+  if(code != CURLE_OK) {
     curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
                   "with code %d (%s)\n",
                   __FILE__, __LINE__, code, curl_easy_strerror(code));
@@ -72,7 +72,7 @@ static CURLcode test_lib1509(const char *URL)
   }
 
   code = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize);
-  if(CURLE_OK != code) {
+  if(code != CURLE_OK) {
     curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
                   "with code %d (%s)\n",
                   __FILE__, __LINE__, code, curl_easy_strerror(code));
index 2603484167a538b08b46ae90ebd34bede1351a5a..78b2bba4c265ab094c7efaa2fa2b582274cee2d1 100644 (file)
@@ -28,7 +28,7 @@
 
 struct pair {
   const char *in;
-  CURLcode *exp;
+  CURLcode *result_exp;
 };
 
 static CURLcode test_lib1597(const char *URL)
@@ -95,7 +95,7 @@ static CURLcode test_lib1597(const char *URL)
   /* Run the tests. */
   for(i = 0; prots[i].in; i++) {
     result = curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, prots[i].in);
-    if(result != *prots[i].exp) {
+    if(result != *prots[i].result_exp) {
       curl_mprintf("unexpectedly '%s' returned %d\n", prots[i].in, result);
       break;
     }
index 51b9538c20303bb853f0dfd2605ec9f29802c266..502b60051717d717de816472566d09c445dc0141 100644 (file)
@@ -35,16 +35,16 @@ static CURLcode test_lib1939(const char *URL)
   if(multi) {
     curl = curl_easy_init();
     if(curl) {
-      CURLcode c;
+      CURLcode result;
       CURLMcode mresult;
 
       /* Crash only happens when using HTTPS */
-      c = curl_easy_setopt(curl, CURLOPT_URL, URL);
-      if(!c)
+      result = curl_easy_setopt(curl, CURLOPT_URL, URL);
+      if(!result)
         /* Any old HTTP tunneling proxy will do here */
-        c = curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
+        result = curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
 
-      if(!c) {
+      if(!result) {
 
         /* We are going to drive the transfer using multi interface here,
            because we want to stop during the middle. */
index c1377cfd2f910172417b3a269c778ab4f17fbf6d..e87eb5ecad37e2a0a2a8b23431555d753823b1a6 100644 (file)
@@ -35,19 +35,19 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data)
   ssize_t idx = ((CURL **)data) - ntlm_curls;
   curl_socket_t sock;
   long longdata;
-  CURLcode code;
+  CURLcode result;
   const size_t failure = (size && nmemb) ? 0 : 1;
   (void)ptr;
 
   ntlm_counter[idx] += (int)(size * nmemb);
 
   /* Get socket being used for this easy handle, otherwise CURL_SOCKET_BAD */
-  code = curl_easy_getinfo(ntlm_curls[idx], CURLINFO_LASTSOCKET, &longdata);
+  result = curl_easy_getinfo(ntlm_curls[idx], CURLINFO_LASTSOCKET, &longdata);
 
-  if(CURLE_OK != code) {
+  if(result != CURLE_OK) {
     curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
                   "with code %d (%s)\n",
-                  __FILE__, __LINE__, code, curl_easy_strerror(code));
+                  __FILE__, __LINE__, result, curl_easy_strerror(result));
     ntlmcb_res = TEST_ERR_MAJOR_BAD;
     return failure;
   }
index 55d933462fda1b0396bbde579400f37eaab8c01a..0eb2a14c3bcf4013bd890fb84d861e462b8ac4b5 100644 (file)
@@ -42,7 +42,7 @@ static CURLcode test_lib3026(const char *URL)
   CURLcode results[NUM_THREADS];
   HANDLE thread_handles[NUM_THREADS];
   unsigned tid_count = NUM_THREADS, i;
-  CURLcode test_failure = CURLE_OK;
+  CURLcode result = CURLE_OK;
   curl_version_info_data *ver;
   (void)URL;
 
@@ -63,7 +63,7 @@ static CURLcode test_lib3026(const char *URL)
                     "GetLastError 0x%08lx\n",
                     __FILE__, __LINE__, GetLastError());
       tid_count = i;
-      test_failure = TEST_ERR_MAJOR_BAD;
+      result = TEST_ERR_MAJOR_BAD;
       goto cleanup;
     }
     thread_handles[i] = th;
@@ -77,11 +77,11 @@ cleanup:
       curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
                     "with code %d (%s)\n", __FILE__, __LINE__,
                     i, results[i], curl_easy_strerror(results[i]));
-      test_failure = TEST_ERR_MAJOR_BAD;
+      result = TEST_ERR_MAJOR_BAD;
     }
   }
 
-  return test_failure;
+  return result;
 }
 
 #elif defined(HAVE_PTHREAD_H)
@@ -103,7 +103,7 @@ static CURLcode test_lib3026(const char *URL)
   CURLcode results[NUM_THREADS];
   pthread_t tids[NUM_THREADS];
   unsigned tid_count = NUM_THREADS, i;
-  CURLcode test_failure = CURLE_OK;
+  CURLcode result = CURLE_OK;
   curl_version_info_data *ver;
   (void)URL;
 
@@ -123,7 +123,7 @@ static CURLcode test_lib3026(const char *URL)
       curl_mfprintf(stderr, "%s:%d Could not create thread, errno %d\n",
                     __FILE__, __LINE__, res);
       tid_count = i;
-      test_failure = TEST_ERR_MAJOR_BAD;
+      result = TEST_ERR_MAJOR_BAD;
       goto cleanup;
     }
   }
@@ -135,11 +135,11 @@ cleanup:
       curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
                     "with code %d (%s)\n", __FILE__, __LINE__,
                     i, results[i], curl_easy_strerror(results[i]));
-      test_failure = TEST_ERR_MAJOR_BAD;
+      result = TEST_ERR_MAJOR_BAD;
     }
   }
 
-  return test_failure;
+  return result;
 }
 
 #else /* without pthread or Windows, this test does not work */
index 7a25c214bb9b8c49d8fc02e89eee8800dde09b3b..845eea239a73981cfea7505fdb7b5719ba683ea7 100644 (file)
@@ -25,7 +25,7 @@
 
 static CURLcode test_lib3027(const char *URL)
 {
-  CURLcode ret = CURLE_OK;
+  CURLcode result = CURLE_OK;
   CURL *curl;
   start_test_timing();
 
@@ -35,18 +35,18 @@ static CURLcode test_lib3027(const char *URL)
   if(curl) {
     curl_easy_setopt(curl, CURLOPT_URL, URL);
     curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
-    ret = curl_easy_perform(curl);
-    if(CURLE_OK == ret) {
+    result = curl_easy_perform(curl);
+    if(result == CURLE_OK) {
       long filetime;
-      ret = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
+      result = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
       /* MTDM fails with 550, so filetime should be -1 */
-      if((CURLE_OK == ret) && (filetime != -1)) {
+      if((result == CURLE_OK) && (filetime != -1)) {
         /* we just need to return something which is not CURLE_OK */
-        ret = CURLE_UNSUPPORTED_PROTOCOL;
+        result = CURLE_UNSUPPORTED_PROTOCOL;
       }
     }
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return ret;
+  return result;
 }
index be7187542a146ba7d83c8f704404558691a66818..b9121c34ac5857cb213f10ec736d6516786ba878 100644 (file)
 
 static CURLcode test_lib512(const char *URL)
 {
-  CURLcode code;
+  CURLcode result;
   int rc = 99;
 
-  code = curl_global_init(CURL_GLOBAL_ALL);
-  if(code == CURLE_OK) {
+  result = curl_global_init(CURL_GLOBAL_ALL);
+  if(result == CURLE_OK) {
     CURL *curl = curl_easy_init();
     if(curl) {
       CURL *curl2;
@@ -43,11 +43,11 @@ static CURLcode test_lib512(const char *URL)
       curl2 = curl_easy_duphandle(curl);
       if(curl2) {
 
-        code = curl_easy_setopt(curl2, CURLOPT_URL, URL);
-        if(code == CURLE_OK) {
+        result = curl_easy_setopt(curl2, CURLOPT_URL, URL);
+        if(result == CURLE_OK) {
 
-          code = curl_easy_perform(curl2);
-          if(code == CURLE_OK)
+          result = curl_easy_perform(curl2);
+          if(result == CURLE_OK)
             rc = 0;
           else
             rc = 1;
index c2d1d3375bff4793313e2109cfeb9b9d174cfecc..cbc5130c79693147263797e39b0ea975dee8a5ad 100644 (file)
@@ -389,28 +389,28 @@ test_cleanup:
 
 static CURLcode test_lib530(const char *URL)
 {
-  CURLcode rc;
+  CURLcode result;
   /* rerun the same transfer multiple times and make it fail in different
      callback calls */
-  rc = testone(URL, 0, 0); /* no callback fails */
-  if(rc)
-    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+  result = testone(URL, 0, 0); /* no callback fails */
+  if(result)
+    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
 
-  rc = testone(URL, 1, 0); /* fail 1st call to timer callback */
-  if(!rc)
-    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+  result = testone(URL, 1, 0); /* fail 1st call to timer callback */
+  if(!result)
+    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
 
-  rc = testone(URL, 2, 0); /* fail 2nd call to timer callback */
-  if(!rc)
-    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+  result = testone(URL, 2, 0); /* fail 2nd call to timer callback */
+  if(!result)
+    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
 
-  rc = testone(URL, 0, 1); /* fail 1st call to socket callback */
-  if(!rc)
-    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+  result = testone(URL, 0, 1); /* fail 1st call to socket callback */
+  if(!result)
+    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
 
-  rc = testone(URL, 0, 2); /* fail 2nd call to socket callback */
-  if(!rc)
-    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+  result = testone(URL, 0, 2); /* fail 2nd call to socket callback */
+  if(!result)
+    curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
 
   return CURLE_OK;
 }
index 3610cbfe06e1e387fcad0df02118980d21b123a6..8609a1d169073d713bfbea7cc91179abdd4ff2d4 100644 (file)
@@ -97,7 +97,7 @@ static void t586_test_unlock(CURL *curl, curl_lock_data data, void *useptr)
 /* the dummy thread function */
 static void *t586_test_fire(void *ptr)
 {
-  CURLcode code;
+  CURLcode result;
   struct t586_Tdata *tdata = (struct t586_Tdata *)ptr;
   CURL *curl;
 
@@ -114,11 +114,11 @@ static void *t586_test_fire(void *ptr)
   curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share);
 
   curl_mprintf("PERFORM\n");
-  code = curl_easy_perform(curl);
-  if(code != CURLE_OK) {
+  result = curl_easy_perform(curl);
+  if(result != CURLE_OK) {
     int i = 0;
     curl_mfprintf(stderr, "perform URL '%s' repeat %d failed, curlcode %d\n",
-                  tdata->url, i, code);
+                  tdata->url, i, result);
   }
 
   curl_mprintf("CLEANUP\n");
index 59ca50c556319f6e1f39bf09d1c433a80d8bd6be..63df7e0dc7e04e3d71d1123687b512582e4219b0 100644 (file)
@@ -224,19 +224,19 @@ static CURLcode t643_cyclic_add(void)
   CURL *curl = curl_easy_init();
   curl_mime *mime = curl_mime_init(curl);
   curl_mimepart *part = curl_mime_addpart(mime);
-  CURLcode a1 = curl_mime_subparts(part, mime);
+  CURLcode result = curl_mime_subparts(part, mime);
 
-  if(a1 == CURLE_BAD_FUNCTION_ARGUMENT) {
+  if(result == CURLE_BAD_FUNCTION_ARGUMENT) {
     curl_mime *submime = curl_mime_init(curl);
     curl_mimepart *subpart = curl_mime_addpart(submime);
 
     curl_mime_subparts(part, submime);
-    a1 = curl_mime_subparts(subpart, mime);
+    result = curl_mime_subparts(subpart, mime);
   }
 
   curl_mime_free(mime);
   curl_easy_cleanup(curl);
-  if(a1 != CURLE_BAD_FUNCTION_ARGUMENT)
+  if(result != CURLE_BAD_FUNCTION_ARGUMENT)
     /* that should have failed */
     return TEST_ERR_FAILURE;
 
index 0077decd2c2e575630b45ce52e4ed07168ed5de3..3acfabc90b270aff14422a39bc4fed4ba7551f1a 100644 (file)
@@ -60,7 +60,7 @@ static int loadfile(const char *filename, void **filedata, size_t *filesize)
 
 static CURLcode test_cert_blob(const char *url, const char *cafile)
 {
-  CURLcode code = CURLE_OUT_OF_MEMORY;
+  CURLcode result = CURLE_OUT_OF_MEMORY;
   CURL *curl;
   struct curl_blob blob;
   size_t certsize;
@@ -84,11 +84,11 @@ static CURLcode test_cert_blob(const char *url, const char *cafile)
     blob.flags = CURL_BLOB_COPY;
     curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &blob);
     curlx_free(certdata);
-    code = curl_easy_perform(curl);
+    result = curl_easy_perform(curl);
   }
   curl_easy_cleanup(curl);
 
-  return code;
+  return result;
 }
 
 static CURLcode test_lib678(const char *URL)
index 13f83526da38b623498ef9ec627568d32cb168ed..71d75b102898898be04603fc32cd417080fdeaf9 100644 (file)
@@ -307,15 +307,15 @@ static CURLMcode t758_checkFdSet(CURLM *multi, struct t758_Sockets *sockets,
                                  const char *name)
 {
   int i;
-  CURLMcode result = CURLM_OK;
+  CURLMcode mresult = CURLM_OK;
   for(i = 0; i < sockets->count; ++i) {
     if(FD_ISSET(sockets->sockets[i], fdset)) {
-      result = t758_saction(multi, sockets->sockets[i], evBitmask, name);
-      if(result)
+      mresult = t758_saction(multi, sockets->sockets[i], evBitmask, name);
+      if(mresult)
         break;
     }
   }
-  return result;
+  return mresult;
 }
 
 static CURLcode t758_one(const char *URL, int timer_fail_at,
@@ -485,14 +485,14 @@ test_cleanup:
 
 static CURLcode test_lib758(const char *URL)
 {
-  CURLcode rc;
+  CURLcode result;
   /* rerun the same transfer multiple times and make it fail in different
      callback calls */
-  rc = t758_one(URL, 0, 0); /* no callback fails */
-  if(rc)
-    curl_mfprintf(stderr, "%s FAILED: %d\n", t758_tag(), rc);
+  result = t758_one(URL, 0, 0); /* no callback fails */
+  if(result)
+    curl_mfprintf(stderr, "%s FAILED: %d\n", t758_tag(), result);
 
-  return rc;
+  return result;
 }
 
 #else /* T578_ENABLED */
index 94e4b202e0bcfdefb73b052d9959ae9e9c23723d..9a9c12a38dfc781e387db1fe59f235fd02ac4be2 100644 (file)
@@ -185,7 +185,7 @@ static int appenddata(char  **dst_buf,   /* dest buffer */
 static int decodedata(char  **buf, /* dest buffer */
                       size_t *len) /* dest buffer data length */
 {
-  CURLcode error = CURLE_OK;
+  CURLcode result = CURLE_OK;
   unsigned char *buf64 = NULL;
   size_t src_len = 0;
 
@@ -193,8 +193,8 @@ static int decodedata(char  **buf, /* dest buffer */
     return GPE_OK;
 
   /* base64 decode the given buffer */
-  error = curlx_base64_decode(*buf, &buf64, &src_len);
-  if(error)
+  result = curlx_base64_decode(*buf, &buf64, &src_len);
+  if(result)
     return GPE_OUT_OF_MEMORY;
 
   if(!src_len) {
index 5fb3d5c6367afb4a4fc296b09ef0284c792e4b9b..3b0d2bf2b551e399cf64f626833ff4a0374a827e 100644 (file)
@@ -36,7 +36,7 @@ struct etest {
 static CURLcode test_unit1302(const char *arg)
 {
   UNITTEST_BEGIN_SIMPLE
-  CURLcode rc;
+  CURLcode result;
   unsigned int i;
 
   /* common base64 encoding */
@@ -132,8 +132,9 @@ static CURLcode test_unit1302(const char *arg)
     size_t dlen;
 
     /* first encode */
-    rc = curlx_base64_encode((const uint8_t *)e->input, e->ilen, &out, &olen);
-    abort_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+    result = curlx_base64_encode((const uint8_t *)e->input, e->ilen,
+                                 &out, &olen);
+    abort_unless(result == CURLE_OK, "return code should be CURLE_OK");
     abort_unless(olen == e->olen, "wrong output size");
     if(memcmp(out, e->output, e->olen)) {
       curl_mfprintf(stderr, "Test %u encoded badly\n", i);
@@ -142,9 +143,10 @@ static CURLcode test_unit1302(const char *arg)
     Curl_safefree(out);
 
     /* then verify decode */
-    rc = curlx_base64_decode(e->output, &decoded, &dlen);
-    if(rc != CURLE_OK) {
-      curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i, (int)rc);
+    result = curlx_base64_decode(e->output, &decoded, &dlen);
+    if(result != CURLE_OK) {
+      curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i,
+                    (int)result);
       unitfail++;
     }
     if(dlen != e->ilen) {
@@ -165,9 +167,9 @@ static CURLcode test_unit1302(const char *arg)
     struct etest *e = &url[i];
     char *out;
     size_t olen;
-    rc = curlx_base64url_encode((const uint8_t *)e->input, e->ilen,
-                                &out, &olen);
-    abort_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+    result = curlx_base64url_encode((const uint8_t *)e->input, e->ilen,
+                                    &out, &olen);
+    abort_unless(result == CURLE_OK, "return code should be CURLE_OK");
     if(olen != e->olen) {
       curl_mfprintf(stderr, "Test %u URL encoded output length %zu "
                     "instead of %zu\n", i, olen, e->olen);
@@ -186,11 +188,11 @@ static CURLcode test_unit1302(const char *arg)
     size_t dlen;
 
     /* then verify decode with illegal inputs */
-    rc = curlx_base64_decode(e->output, &decoded, &dlen);
-    if(rc != CURLE_BAD_CONTENT_ENCODING) {
+    result = curlx_base64_decode(e->output, &decoded, &dlen);
+    if(result != CURLE_BAD_CONTENT_ENCODING) {
       curl_mfprintf(stderr, "Test %u URL bad decoded badly. "
                     "Returned '%d', expected '%d'\n",
-                    i, (int)rc, CURLE_BAD_CONTENT_ENCODING);
+                    i, (int)result, CURLE_BAD_CONTENT_ENCODING);
       unitfail++;
     }
   }
index 106bc3868219a1cce87c4395026632a072d07bea..81dbdfa3c2abc61a3868b5d1ef26faf550bb52b2 100644 (file)
@@ -106,8 +106,8 @@ static CURLcode test_unit1305(const char *arg)
 
   /* Test 1305 exits without adding anything to the hash */
   if(testnum == 1306) {
-    CURLcode rc = create_node();
-    abort_unless(rc == CURLE_OK, "data node creation failed");
+    CURLcode result = create_node();
+    abort_unless(result == CURLE_OK, "data node creation failed");
     key_len = strlen(data_key);
 
     data_node->refcount = 1; /* hash will hold the reference */
index fdeded3d2881cfaebb743acc96f8714985093cbc..50a8787ada7807b00418933121e298c0008d9060 100644 (file)
@@ -48,14 +48,14 @@ static CURLcode test_unit1608(const char *arg)
   UNITTEST_BEGIN(t1608_setup())
 
   int i;
-  CURLcode code;
+  CURLcode result;
   struct Curl_addrinfo *addrhead = addrs;
 
   struct Curl_easy *easy = curl_easy_init();
   abort_unless(easy, "out of memory");
 
-  code = curl_easy_setopt(easy, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
-  abort_unless(code == CURLE_OK, "curl_easy_setopt failed");
+  result = curl_easy_setopt(easy, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
+  abort_unless(result == CURLE_OK, "curl_easy_setopt failed");
 
   /* Shuffle repeatedly and make sure that the list changes */
   for(i = 0; i < 10; i++) {
index 50fbe64a36ab26e3e735a1a09a08631341799e7b..6c1f52a8dd00bf16908b3501ead4c3c6aae15fde 100644 (file)
@@ -41,9 +41,9 @@ static void t1620_parse(const char *input,
   char *userstr = NULL;
   char *passwdstr = NULL;
   char *options = NULL;
-  CURLcode rc = Curl_parse_login_details(input, strlen(input), &userstr,
-                                         &passwdstr, &options);
-  fail_unless(rc == CURLE_OK, "Curl_parse_login_details() failed");
+  CURLcode result = Curl_parse_login_details(input, strlen(input), &userstr,
+                                             &passwdstr, &options);
+  fail_unless(result == CURLE_OK, "Curl_parse_login_details() failed");
 
   fail_unless(!!exp_username == !!userstr, "username expectation failed");
   fail_unless(!!exp_password == !!passwdstr, "password expectation failed");
@@ -70,32 +70,32 @@ static CURLcode test_unit1620(const char *arg)
 {
   UNITTEST_BEGIN(t1620_setup())
 
-  CURLcode rc;
+  CURLcode result;
   struct Curl_easy *empty;
   enum dupstring i;
 
   bool async = FALSE;
   bool protocol_connect = FALSE;
 
-  rc = Curl_open(&empty);
-  if(rc)
+  result = Curl_open(&empty);
+  if(result)
     goto unit_test_abort;
-  fail_unless(rc == CURLE_OK, "Curl_open() failed");
+  fail_unless(result == CURLE_OK, "Curl_open() failed");
 
-  rc = Curl_connect(empty, &async, &protocol_connect);
-  fail_unless(rc == CURLE_URL_MALFORMAT,
+  result = Curl_connect(empty, &async, &protocol_connect);
+  fail_unless(result == CURLE_URL_MALFORMAT,
               "Curl_connect() failed to return CURLE_URL_MALFORMAT");
 
   fail_unless(empty->magic == CURLEASY_MAGIC_NUMBER,
               "empty->magic should be equal to CURLEASY_MAGIC_NUMBER");
 
   /* double invoke to ensure no dependency on internal state */
-  rc = Curl_connect(empty, &async, &protocol_connect);
-  fail_unless(rc == CURLE_URL_MALFORMAT,
+  result = Curl_connect(empty, &async, &protocol_connect);
+  fail_unless(result == CURLE_URL_MALFORMAT,
               "Curl_connect() failed to return CURLE_URL_MALFORMAT");
 
-  rc = Curl_init_do(empty, empty->conn);
-  fail_unless(rc == CURLE_OK, "Curl_init_do() failed");
+  result = Curl_init_do(empty, empty->conn);
+  fail_unless(result == CURLE_OK, "Curl_init_do() failed");
 
   t1620_parse("hostname", "hostname", NULL, NULL);
   t1620_parse("user:password", "user", "password", NULL);
@@ -118,8 +118,8 @@ static CURLcode test_unit1620(const char *arg)
     fail_unless(empty->set.str[i] == NULL, "Curl_free() did not set to NULL");
   }
 
-  rc = Curl_close(&empty);
-  fail_unless(rc == CURLE_OK, "Curl_close() failed");
+  result = Curl_close(&empty);
+  fail_unless(result == CURLE_OK, "Curl_close() failed");
 
   UNITTEST_END(curl_global_cleanup())
 }
index 251f2c1c8093cabeda09010cba8c2cbda3026840..10fc9797248cd778cd325ae385bf838ecbef8f1c 100644 (file)
@@ -364,7 +364,7 @@ static CURLcode test_unit1651(const char *arg)
     0x48, 0x88, 0x61, 0x54, 0x4A, 0x2B, 0xB7, 0x6A, 0x12, 0x08, 0xFB,
   };
 
-  CURLcode res;
+  CURLcode result;
   const char *beg = (const char *)&cert[0];
   const char *end = (const char *)&cert[sizeof(cert)];
   struct Curl_easy *data;
@@ -378,9 +378,9 @@ static CURLcode test_unit1651(const char *arg)
 
   data = curl_easy_init();
   if(data) {
-    res = Curl_extract_certinfo(data, 0, beg, end);
+    result = Curl_extract_certinfo(data, 0, beg, end);
 
-    fail_unless(res == CURLE_OK, "Curl_extract_certinfo returned error");
+    fail_unless(result == CURLE_OK, "Curl_extract_certinfo returned error");
 
     /* a poor man's fuzzing of some initial data to make sure nothing bad
        happens */
index 0c8adcded6bf8005d346c51ee8d82e8486231387..8d14a119877e3a49b2100fd6d969b0df619bb509 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 res;
+  CURLcode result;
   struct altsvcinfo *asi = Curl_altsvc_init();
   abort_if(!asi, "Curl_altsvc_i");
-  res = Curl_altsvc_load(asi, arg);
-  if(res) {
-    fail_if(res, "Curl_altsvc_load");
+  result = Curl_altsvc_load(asi, arg);
+  if(result) {
+    fail_if(result, "Curl_altsvc_load");
     goto fail;
   }
   curl_global_init(CURL_GLOBAL_ALL);
@@ -50,92 +50,92 @@ 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);
 
-  res = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
-                          ALPN_h1, "example.org", 8080);
-  fail_if(res, "Curl_altsvc_parse() failed!");
+  result = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
+                             ALPN_h1, "example.org", 8080);
+  fail_if(result, "Curl_altsvc_parse() failed!");
   fail_unless(Curl_llist_count(&asi->list) == 5, "wrong number of entries");
 
-  res = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n",
-                          ALPN_h1, "2.example.org", 8080);
-  fail_if(res, "Curl_altsvc_parse(2) failed!");
+  result = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n",
+                             ALPN_h1, "2.example.org", 8080);
+  fail_if(result, "Curl_altsvc_parse(2) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 6, "wrong number of entries");
 
-  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!");
+  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!");
   /* that one should make two entries */
   fail_unless(Curl_llist_count(&asi->list) == 8, "wrong number of entries");
 
-  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!");
+  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!");
   fail_unless(Curl_llist_count(&asi->list) == 9, "wrong number of entries");
 
   /* quoted 'ma' value */
-  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!");
+  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!");
   fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
 
-  res = Curl_altsvc_parse(curl, asi,
-                          "h2=\":443\"; ma=180, h3=\":443\"; "
-                          "persist = \"1\"; ma = 120;\r\n",
-                          ALPN_h1, "curl.se", 80);
-  fail_if(res, "Curl_altsvc_parse(6) failed!");
+  result = Curl_altsvc_parse(curl, asi,
+                             "h2=\":443\"; ma=180, h3=\":443\"; "
+                             "persist = \"1\"; ma = 120;\r\n",
+                             ALPN_h1, "curl.se", 80);
+  fail_if(result, "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 */
-  res = Curl_altsvc_parse(curl, asi, "clear;\r\n",
-                          ALPN_h1, "curl.se", 80);
-  fail_if(res, "Curl_altsvc_parse(7) failed!");
+  result = Curl_altsvc_parse(curl, asi, "clear;\r\n",
+                             ALPN_h1, "curl.se", 80);
+  fail_if(result, "Curl_altsvc_parse(7) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
 
-  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!");
+  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!");
   fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries");
 
   /* clear - without semicolon */
-  res = Curl_altsvc_parse(curl, asi, "clear\r\n",
-                          ALPN_h1, "curl.se", 80);
-  fail_if(res, "Curl_altsvc_parse(7) failed!");
+  result = Curl_altsvc_parse(curl, asi, "clear\r\n",
+                             ALPN_h1, "curl.se", 80);
+  fail_if(result, "Curl_altsvc_parse(7) failed!");
   fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
 
   /* only a non-existing alpn */
-  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!");
+  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!");
 
   /* missing quote in alpn host */
-  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!");
+  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!");
 
   /* missing port in hostname */
-  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!");
+  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!");
 
   /* illegal port in hostname */
-  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!");
-
-  res = Curl_altsvc_parse(curl, asi,
-                          "h2=\"test2.se:443\"; ma=\"180 \" ; unknown=2, "
-                          "h2=\"test3.se:443\"; ma = 120;\r\n",
-                          ALPN_h2, "test.se", 443);
-  fail_if(res, "Curl_altsvc_parse(12) failed!");
+  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!");
+
+  result = Curl_altsvc_parse(curl, asi,
+                             "h2=\"test2.se:443\"; ma=\"180 \" ; unknown=2, "
+                             "h2=\"test3.se:443\"; ma = 120;\r\n",
+                             ALPN_h2, "test.se", 443);
+  fail_if(result, "Curl_altsvc_parse(12) failed!");
 
   Curl_altsvc_save(curl, asi, outname);
 
index cdd0df9bb21de5a93b015abc0f97f15b2a423b19..d3a60569476f128991690158d5a3a7c96f1030d7 100644 (file)
 struct test_spec {
   const char *input;
   const char *exp_output;
-  CURLcode exp_res;
+  CURLcode result_exp;
 };
 
 static bool do_test(const struct test_spec *spec, size_t i,
                     struct dynbuf *dbuf)
 {
-  CURLcode res;
+  CURLcode result;
   const char *in = spec->input;
 
   curlx_dyn_reset(dbuf);
-  res = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
-  if(res != spec->exp_res) {
+  result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
+  if(result != spec->result_exp) {
     curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
-                  i, spec->exp_res, res);
+                  i, spec->result_exp, result);
     return FALSE;
   }
-  else if(!res && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
+  else if(!result && 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 515e2b595ae8844d73f46098b35327d864cb100b..7c769e78da76ba39e9b92f23a9fe0aa5667997ba 100644 (file)
 struct test1657_spec {
   CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
   size_t n;
-  CURLcode exp_res;
+  CURLcode result_exp;
 };
 
 static CURLcode make1657_nested(const struct test1657_spec *spec,
                                 struct dynbuf *buf)
 {
-  CURLcode r;
+  CURLcode result;
   size_t i;
   unsigned char open_undef[] = { 0x32, 0x80 };
   unsigned char close_undef[] = { 0x00, 0x00 };
 
   for(i = 0; i < spec->n; ++i) {
-    r = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
-    if(r)
-      return r;
+    result = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
+    if(result)
+      return result;
   }
   for(i = 0; i < spec->n; ++i) {
-    r = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
-    if(r)
-      return r;
+    result = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
+    if(result)
+      return result;
   }
   return CURLE_OK;
 }
@@ -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 res;
+  CURLcode result;
   struct Curl_asn1Element elem;
   const char *in;
 
   memset(&elem, 0, sizeof(elem));
   curlx_dyn_reset(buf);
-  res = spec->setbuf(spec, buf);
-  if(res) {
-    curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, res);
+  result = spec->setbuf(spec, buf);
+  if(result) {
+    curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, result);
     return FALSE;
   }
   in = curlx_dyn_ptr(buf);
-  res = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
-  if(res != spec->exp_res) {
+  result = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
+  if(result != spec->result_exp) {
     curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
-                  i, spec->exp_res, res);
+                  i, spec->result_exp, result);
     return FALSE;
   }
   return TRUE;
index 3ba81d939bdb01c298e99e161af49662ac9c1e80..a0698b31cd39e5724848f90fc34ee610bdbe8ff3 100644 (file)
@@ -45,9 +45,9 @@ static CURLcode test_unit1660(const char *arg)
 
   struct testit {
     const char *host;
-    const char *chost;  /* if non-NULL, use to lookup with */
-    const char *hdr;    /* if NULL, just do the lookup */
-    const CURLcode res; /* parse result */
+    const char *chost;     /* if non-NULL, use to lookup with */
+    const char *hdr;       /* if NULL, just do the lookup */
+    const CURLcode result; /* parse result */
   };
 
   static const struct testit headers[] = {
@@ -102,7 +102,7 @@ static CURLcode test_unit1660(const char *arg)
     { NULL, NULL, NULL, CURLE_OK }
   };
 
-  CURLcode res;
+  CURLcode result;
   struct stsentry *e;
   struct hsts *h = Curl_hsts_init();
   int i;
@@ -124,16 +124,16 @@ static CURLcode test_unit1660(const char *arg)
 
   for(i = 0; headers[i].host; i++) {
     if(headers[i].hdr) {
-      res = Curl_hsts_parse(h, headers[i].host, headers[i].hdr);
+      result = Curl_hsts_parse(h, headers[i].host, headers[i].hdr);
 
-      if(res != headers[i].res) {
+      if(result != headers[i].result) {
         curl_mfprintf(stderr, "Curl_hsts_parse(%s) failed: %d\n",
-                      headers[i].hdr, res);
+                      headers[i].hdr, result);
         unitfail++;
         continue;
       }
-      else if(res) {
-        curl_mprintf("Input %u: error %d\n", i, (int)res);
+      else if(result) {
+        curl_mprintf("Input %u: error %d\n", i, (int)result);
         continue;
       }
     }
index 4e6289ae661c173448bb53059d9d4395c16ca30f..f79fd75a81d17de6c96d40e1521f7b8bbbe3c92e 100644 (file)
@@ -43,13 +43,13 @@ static void t1663_parse(const char *input_data,
                         const char *exp_dev,
                         const char *exp_iface,
                         const char *exp_host,
-                        CURLcode exp_rc)
+                        CURLcode result_exp)
 {
   char *dev = NULL;
   char *iface = NULL;
   char *host = NULL;
-  CURLcode rc = Curl_parse_interface(input_data, &dev, &iface, &host);
-  fail_unless(rc == exp_rc, "Curl_parse_interface() failed");
+  CURLcode result = Curl_parse_interface(input_data, &dev, &iface, &host);
+  fail_unless(result == result_exp, "Curl_parse_interface() failed");
 
   fail_unless(!!exp_dev == !!dev, "dev expectation failed.");
   fail_unless(!!exp_iface == !!iface, "iface expectation failed");
index 5961ade9ba35a0198b6dec2d854fbfc572a3b129..acea05f798e3e848ddc16f3531dcbc7e1507a5b9 100644 (file)
@@ -83,7 +83,7 @@ struct test_case {
   int exp_cf6_creations;
   timediff_t min_duration_ms;
   timediff_t max_duration_ms;
-  CURLcode exp_res;
+  CURLcode result_exp;
   const char *pref_family;
 };
 
@@ -242,11 +242,11 @@ static void check_result(const struct test_case *tc, struct test_result *tr)
   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_res && CURLE_OPERATION_TIMEDOUT != tr->result) {
+  if(tr->result != tc->result_exp && CURLE_OPERATION_TIMEDOUT != tr->result) {
     /* 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_res, tr->result);
+                  tc->id, tc->result_exp, tr->result);
     fail(msg);
   }
   if(tr->cf4.creations != tc->exp_cf4_creations) {
index 6a1ca2f1bd364aeee7ed332fa7df9fb397c6e1ff..1a211db28e8a286fb010cf95d1219f29a37b5458 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 res;
+  CURLcode result;
   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");
 
-  res = Curl_bufq_write(&q, test_data, wsize, &n2);
+  result = Curl_bufq_write(&q, test_data, wsize, &n2);
   fail_unless(n2 <= wsize, "write: wrong size returned");
-  fail_unless(res == CURLE_OK, "write: wrong result returned");
+  fail_unless(result == CURLE_OK, "write: wrong result returned");
 
   /* write empty bufq full */
   nwritten = 0;
   Curl_bufq_reset(&q);
   while(!Curl_bufq_is_full(&q)) {
-    res = Curl_bufq_write(&q, test_data, wsize, &n2);
-    if(!res) {
+    result = Curl_bufq_write(&q, test_data, wsize, &n2);
+    if(!result) {
       nwritten += n2;
     }
-    else if(res != CURLE_AGAIN) {
-      fail_unless(res == CURLE_AGAIN, "write-loop: unexpected result");
+    else if(result != CURLE_AGAIN) {
+      fail_unless(result == 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)) {
-    res = Curl_bufq_read(&q, test_data, rsize, &n2);
-    if(!res) {
+    result = Curl_bufq_read(&q, test_data, rsize, &n2);
+    if(!result) {
       nread += n2;
     }
-    else if(res != CURLE_AGAIN) {
-      fail_unless(res == CURLE_AGAIN, "read-loop: unexpected result");
+    else if(result != CURLE_AGAIN) {
+      fail_unless(result == 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) {
-    res = Curl_bufq_write(&q, test_data, wsize, &n2);
-    if(res && res != CURLE_AGAIN) {
-      fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected write result");
+    result = Curl_bufq_write(&q, test_data, wsize, &n2);
+    if(result && result != CURLE_AGAIN) {
+      fail_unless(result == CURLE_AGAIN, "rw-loop: unexpected write result");
       break;
     }
-    res = Curl_bufq_read(&q, test_data, rsize, &n2);
-    if(res && res != CURLE_AGAIN) {
-      fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected read result");
+    result = Curl_bufq_read(&q, test_data, rsize, &n2);
+    if(result && result != CURLE_AGAIN) {
+      fail_unless(result == 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)) {
-    res = Curl_bufq_write(&q, test_data, wsize, &n2);
-    if(res || n2 != wsize) {
-      fail_unless(!res && n2 == wsize, "write should be complete");
+    result = Curl_bufq_write(&q, test_data, wsize, &n2);
+    if(result || n2 != wsize) {
+      fail_unless(!result && 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 */
-  res = Curl_bufq_write(&q, test_data, wsize, &n2);
-  fail_unless(!res && n2 == wsize, "write should be complete");
+  result = Curl_bufq_write(&q, test_data, wsize, &n2);
+  fail_unless(!result && n2 == wsize, "write should be complete");
   nwritten += n2;
   /* see that we get all out again */
   nread = 0;
   while(!Curl_bufq_is_empty(&q)) {
-    res = Curl_bufq_read(&q, test_data, rsize, &n2);
-    if(res) {
-      fail_unless(res, "read-loop: unexpected fail");
+    result = Curl_bufq_read(&q, test_data, rsize, &n2);
+    if(result) {
+      fail_unless(result, "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 res;
+  CURLcode result;
   unsigned char buf[16 * 1024];
 
   Curl_bufq_init(&q, 8 * 1024, 12);
-  res = Curl_bufq_read(&q, buf, 128, &n);
-  fail_unless(res && res == CURLE_AGAIN, "read empty fail");
+  result = Curl_bufq_read(&q, buf, 128, &n);
+  fail_unless(result && result == CURLE_AGAIN, "read empty fail");
   Curl_bufq_free(&q);
 
   check_bufq(0, 1024, 4, 128, 128, BUFQ_OPT_NONE);
index c33e8d63d1ae507ca9d68cd2d5c8d461f0ef65f9..4c757bd4b79fe6b2e34415a66c514c9375b5e83d 100644 (file)
@@ -33,7 +33,7 @@ static CURLcode test_unit2602(const char *arg)
 
   struct dynhds hds;
   struct dynbuf dbuf;
-  CURLcode res;
+  CURLcode result;
   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 */
-  res = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
-  fail_unless(res, "add should have failed");
+  result = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
+  fail_unless(result, "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");
 
-  res = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
-  fail_unless(res, "add should have failed");
-  if(!res) {
+  result = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
+  fail_unless(result, "add should have failed");
+  if(!result) {
     fail_unless(Curl_dynhds_ccount_name(&hds, "bLABlaBlA") == 0, "should");
     fail_if(Curl_dynhds_cadd(&hds, "Bla-Bla", "thingies"), "add failed");
 
index fbe5f89420af74bbe8ec1035c163574e30cc7393..69c49e046abaad96d092188d17626f4d04373ead 100644 (file)
@@ -65,7 +65,7 @@ static void parse_success(const struct tcase *t)
   struct h1_req_parser p;
   const uint8_t *buf;
   size_t buflen, i, in_len, in_consumed;
-  CURLcode err;
+  CURLcode result;
   size_t nread;
 
   Curl_h1_req_parse_init(&p, 1024);
@@ -74,10 +74,10 @@ static void parse_success(const struct tcase *t)
     buf = (const uint8_t *)t->input[i];
     buflen = strlen(t->input[i]);
     in_len += buflen;
-    err = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme,
-                                 t->custom_method, 0, &nread);
-    if(err) {
-      curl_mfprintf(stderr, "got err %d parsing: '%s'\n", err, buf);
+    result = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme,
+                                    t->custom_method, 0, &nread);
+    if(result) {
+      curl_mfprintf(stderr, "got result %d parsing: '%s'\n", result, buf);
       fail("error consuming");
     }
     in_consumed += (size_t)nread;
index e8fce4033420c7b5859d514e10d156eca1af2c87..4673f0c1d59cc37d79d676434c71da2f29965184 100644 (file)
@@ -35,7 +35,7 @@ static CURLcode test_unit2605(const char *arg)
     curl_off_t filesize;
     curl_off_t start;
     curl_off_t size;
-    CURLcode res;
+    CURLcode result;
   };
 
   int i;
@@ -77,15 +77,16 @@ static CURLcode test_unit2605(const char *arg)
     for(i = 0; list[i].r; i++) {
       curl_off_t start;
       curl_off_t size;
-      CURLcode res;
+      CURLcode result;
       curl_mprintf("%u: '%s' (file size: %" FMT_OFF_T ")\n", i, list[i].r,
                    list[i].filesize);
-      res = Curl_ssh_range(curl, list[i].r, list[i].filesize, &start, &size);
-      if(res != list[i].res) {
-        curl_mprintf("... returned %d\n", res);
+      result = Curl_ssh_range(curl, list[i].r, list[i].filesize, &start,
+                              &size);
+      if(result != list[i].result) {
+        curl_mprintf("... returned %d\n", result);
         unitfail++;
       }
-      if(!res) {
+      if(!result) {
         if(start != list[i].start) {
           curl_mprintf("... start (%" FMT_OFF_T ") was not %" FMT_OFF_T " \n",
                        start, list[i].start);
index f7c82cee3768c035a9a0296682459cccb562ff21..46c9b13a3f4cf9bc7987e00d9996a2a96513c5af 100644 (file)
@@ -75,7 +75,7 @@ static CURLcode test_unit3200(const char *arg)
 #endif
 
   size_t i;
-  CURLcode res = CURLE_OK;
+  CURLcode result = CURLE_OK;
   for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) {
     FILE *fp;
     struct dynbuf buf;
@@ -95,62 +95,62 @@ static CURLcode test_unit3200(const char *arg)
     curl_mfprintf(stderr, "Test %zd...", i);
     switch(i) {
     case 0:
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE1\n", line),
+      fail_unless(!result && line && !strcmp("LINE1\n", line),
                   "First line failed (1)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE2 NEWLINE\n", line),
+      fail_unless(!result && line && !strcmp("LINE2 NEWLINE\n", line),
                   "Second line failed (1)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       abort_unless(eof, "Missed EOF (1)");
       break;
     case 1:
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE1\n", line),
+      fail_unless(!result && line && !strcmp("LINE1\n", line),
                   "First line failed (2)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE2 NONEWLINE\n", line),
+      fail_unless(!result && line && !strcmp("LINE2 NONEWLINE\n", line),
                   "Second line failed (2)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       abort_unless(eof, "Missed EOF (2)");
       break;
     case 2:
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE1\n", line),
+      fail_unless(!result && line && !strcmp("LINE1\n", line),
                   "First line failed (3)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       fail_unless(!curlx_dyn_len(&buf),
                   "Did not detect max read on EOF (3)");
       break;
     case 3:
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE1\n", line),
+      fail_unless(!result && line && !strcmp("LINE1\n", line),
                   "First line failed (4)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       fail_unless(!curlx_dyn_len(&buf),
                   "Did not ignore partial on EOF (4)");
       break;
     case 4:
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE1\n", line),
+      fail_unless(!result && line && !strcmp("LINE1\n", line),
                   "First line failed (5)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       fail_unless(!curlx_dyn_len(&buf),
                   "Did not bail out on too long line");
       break;
     case 5:
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       line = curlx_dyn_ptr(&buf);
-      fail_unless(!res && line && !strcmp("LINE1\x1aTEST\n", line),
+      fail_unless(!result && line && !strcmp("LINE1\x1aTEST\n", line),
                   "Missed/Misinterpreted ^Z (6)");
-      res = Curl_get_line(&buf, fp, &eof);
+      result = Curl_get_line(&buf, fp, &eof);
       abort_unless(eof, "Missed EOF (6)");
       break;
     default:
@@ -161,7 +161,7 @@ static CURLcode test_unit3200(const char *arg)
     curlx_fclose(fp);
     curl_mfprintf(stderr, "OK\n");
   }
-  return res;
+  return result;
 
 #endif