tidy-up: whitespace, indent, #if 0

Closes #18090
This commit is contained in:
Viktor Szakats 2025-07-25 16:23:15 +02:00
parent daa5b044b8
commit 58e0ff809f
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
9 changed files with 171 additions and 172 deletions

View File

@ -125,7 +125,7 @@ jobs:
install_steps: skipall
generate: -DCURL_USE_MBEDTLS=ON -DENABLE_DEBUG=ON -DCURL_USE_PKGCONFIG=OFF -DCURL_COMPLETION_FISH=ON -DCURL_COMPLETION_ZSH=ON
- name: awslc
- name: 'awslc'
install_packages: zlib1g-dev
install_steps: awslc pytest
configure: LDFLAGS=-Wl,-rpath,/home/runner/awslc/lib --with-openssl=/home/runner/awslc --enable-ech

View File

@ -3013,7 +3013,7 @@ if test "$want_idn" = "yes"; then
tst_links_libidn="no"
])
#
AC_CHECK_HEADERS( idn2.h )
AC_CHECK_HEADERS(idn2.h)
if test "$tst_links_libidn" = "yes"; then
AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])

View File

@ -135,7 +135,7 @@
_curl_easy_setopt_err_error_buffer(); \
if((option) == CURLOPT_CURLU) \
if(!curlcheck_ptr((value), CURLU)) \
_curl_easy_setopt_err_curlu(); \
_curl_easy_setopt_err_curlu(); \
if((option) == CURLOPT_STDERR) \
if(!curlcheck_FILE(value)) \
_curl_easy_setopt_err_FILE(); \
@ -178,7 +178,7 @@
_curl_easy_getinfo_err_curl_slist(); \
if(curlcheck_tlssessioninfo_info(info)) \
if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
_curl_easy_getinfo_err_curl_tlssessioninfo(); \
_curl_easy_getinfo_err_curl_tlssessioninfo(); \
if(curlcheck_certinfo_info(info)) \
if(!curlcheck_arr((arg), struct curl_certinfo *)) \
_curl_easy_getinfo_err_curl_certinfo(); \
@ -546,7 +546,7 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
curlcheck_arr((expr), unsigned char))
/* evaluates to true if expr is a CURL * */
#define curlcheck_curl(expr) \
#define curlcheck_curl(expr) \
(curlcheck_NULL(expr) || \
__builtin_types_compatible_p(__typeof__(expr), CURL *))
@ -840,8 +840,8 @@ typedef long (*_curl_chunk_bgn_callback2)(void *, void *, int);
curlcheck_cb_compatible((expr), curl_sshhostkeycallback))
/* evaluates to true if expr is of type curl_sshkeycallback */
#define curlcheck_ssh_key_cb(expr) \
(curlcheck_NULL(expr) || \
#define curlcheck_ssh_key_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_sshkeycallback))
/* evaluates to true if expr is of type curl_interleave_callback */
@ -855,13 +855,13 @@ typedef size_t (*_curl_interleave_callback2)(char *p, size_t s,
size_t n, void *u);
/* evaluates to true if expr is of type curl_prereq_callback */
#define curlcheck_prereq_cb(expr) \
(curlcheck_NULL(expr) || \
#define curlcheck_prereq_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_prereq_callback))
/* evaluates to true if expr is of type curl_trailer_callback */
#define curlcheck_trailer_cb(expr) \
(curlcheck_NULL(expr) || \
#define curlcheck_trailer_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_trailer_callback))
#endif /* CURLINC_TYPECHECK_GCC_H */

View File

@ -1339,7 +1339,6 @@ out:
result = Curl_1st_err(result, check_and_set_expiry(cf, data, &pktx));
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_recv(blen=%zu) -> %dm, %zu",
stream ? stream->id : -1, blen, result, *pnread);
CF_DATA_RESTORE(cf, save);
return result;

View File

@ -1349,17 +1349,17 @@ schannel_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
failf(data, "schannel: %s",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
return CURLE_PEER_FAILED_VERIFICATION;
/*
case SEC_E_INVALID_HANDLE:
case SEC_E_INVALID_TOKEN:
case SEC_E_LOGON_DENIED:
case SEC_E_TARGET_UNKNOWN:
case SEC_E_NO_AUTHENTICATING_AUTHORITY:
case SEC_E_INTERNAL_ERROR:
case SEC_E_NO_CREDENTIALS:
case SEC_E_UNSUPPORTED_FUNCTION:
case SEC_E_APPLICATION_PROTOCOL_MISMATCH:
*/
#if 0
case SEC_E_INVALID_HANDLE:
case SEC_E_INVALID_TOKEN:
case SEC_E_LOGON_DENIED:
case SEC_E_TARGET_UNKNOWN:
case SEC_E_NO_AUTHENTICATING_AUTHORITY:
case SEC_E_INTERNAL_ERROR:
case SEC_E_NO_CREDENTIALS:
case SEC_E_UNSUPPORTED_FUNCTION:
case SEC_E_APPLICATION_PROTOCOL_MISMATCH:
#endif
default:
failf(data, "schannel: next InitializeSecurityContext failed: %s",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));

View File

@ -370,7 +370,7 @@ curl_includes_winsock2="\
/* includes start */
#ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
#endif
@ -389,7 +389,7 @@ curl_includes_ws2tcpip="\
/* includes start */
#ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
# include <ws2tcpip.h>

View File

@ -323,8 +323,8 @@ static CURLcode test_cli_hx_download(const char *URL)
t = &transfer_d[i];
t->easy = curl_easy_init();
if(!t->easy ||
setup_hx_download(t->easy, url, t, http_version, host, share,
use_earlydata, fresh_connect)) {
setup_hx_download(t->easy, url, t, http_version, host, share,
use_earlydata, fresh_connect)) {
curl_mfprintf(stderr, "[t-%d] FAILED setup\n", (int)i);
result = (CURLcode)1;
goto cleanup;

View File

@ -44,39 +44,39 @@ static size_t t1507_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
static CURLcode test_lib1507(const char *URL)
{
static const int MULTI_PERFORM_HANG_TIMEOUT = 60 * 1000;
static const int MULTI_PERFORM_HANG_TIMEOUT = 60 * 1000;
CURLcode res = CURLE_OK;
CURL *curl = NULL;
CURLM *mcurl = NULL;
int still_running = 1;
struct curltime mp_start;
struct curl_slist *rcpt_list = NULL;
CURLcode res = CURLE_OK;
CURL *curl = NULL;
CURLM *mcurl = NULL;
int still_running = 1;
struct curltime mp_start;
struct curl_slist *rcpt_list = NULL;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl_global_init(CURL_GLOBAL_DEFAULT);
easy_init(curl);
easy_init(curl);
multi_init(mcurl);
multi_init(mcurl);
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
/* more addresses can be added here
rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
*/
curl_easy_setopt(curl, CURLOPT_URL, URL);
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
#if 0
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
/* more addresses can be added here */
rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
#endif
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, t1507_read_cb);
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
multi_add_handle(mcurl, curl);
curl_easy_setopt(curl, CURLOPT_URL, URL);
#if 0
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
#endif
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, t1507_read_cb);
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
multi_add_handle(mcurl, curl);
mp_start = curlx_now();
mp_start = curlx_now();
/* we start some action by calling perform right away */
curl_multi_perform(mcurl, &still_running);

View File

@ -27,142 +27,142 @@
static CURLcode test_lib661(const char *URL)
{
CURLcode res;
CURL *curl = NULL;
char *newURL = NULL;
struct curl_slist *slist = NULL;
CURLcode res;
CURL *curl = NULL;
char *newURL = NULL;
struct curl_slist *slist = NULL;
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
/* test: CURLFTPMETHOD_SINGLECWD with absolute path should
skip CWD to entry path */
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
/* test: CURLFTPMETHOD_SINGLECWD with absolute path should
skip CWD to entry path */
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = curl_maprintf("%s/folderB/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = curl_maprintf("%s/folderB/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
/* test: CURLFTPMETHOD_NOCWD with absolute path should
never emit CWD (for both new and reused easy handle) */
curl_easy_cleanup(curl);
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
/* test: CURLFTPMETHOD_NOCWD with absolute path should
never emit CWD (for both new and reused easy handle) */
curl_easy_cleanup(curl);
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
curl_free(newURL);
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
/* curve ball: CWD /folderB before reusing connection with _NOCWD */
curl_free(newURL);
newURL = curl_maprintf("%s/folderB/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
/* curve ball: CWD /folderB before reusing connection with _NOCWD */
curl_free(newURL);
newURL = curl_maprintf("%s/folderB/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
not emit CWD for first FTP access after login */
curl_easy_cleanup(curl);
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
not emit CWD for first FTP access after login */
curl_easy_cleanup(curl);
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
slist = curl_slist_append(NULL, "SYST");
if(!slist) {
curl_mfprintf(stderr, "curl_slist_append() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
slist = curl_slist_append(NULL, "SYST");
if(!slist) {
curl_mfprintf(stderr, "curl_slist_append() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
/* test: CURLFTPMETHOD_SINGLECWD with home-relative path should
not emit CWD for first FTP access after login */
curl_easy_cleanup(curl);
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
/* test: CURLFTPMETHOD_SINGLECWD with home-relative path should
not emit CWD for first FTP access after login */
curl_easy_cleanup(curl);
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
not emit CWD for second FTP access when not needed +
bonus: see if path buffering survives curl_easy_reset() */
curl_easy_reset(curl);
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
/* test: CURLFTPMETHOD_NOCWD with home-relative path should
not emit CWD for second FTP access when not needed +
bonus: see if path buffering survives curl_easy_reset() */
curl_easy_reset(curl);
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
test_cleanup:
if(res)
curl_mfprintf(stderr, "test encountered error %d\n", res);
curl_slist_free_all(slist);
curl_free(newURL);
curl_easy_cleanup(curl);
curl_global_cleanup();
if(res)
curl_mfprintf(stderr, "test encountered error %d\n", res);
curl_slist_free_all(slist);
curl_free(newURL);
curl_easy_cleanup(curl);
curl_global_cleanup();
return res;
return res;
}