clang-tidy: enable more checks, fix fallouts

- enable three checks:
  - bugprone-invalid-enum-default-initialization
  - bugprone-sizeof-expression
  - readability-inconsistent-declaration-parameter-name (strict)
- fix remaining discrepancies with arg names in prototypes
  and implementation, in strict mode.
- document reason for some checks tested but not enabled.

Closes #20794
This commit is contained in:
Viktor Szakats 2026-03-03 01:58:29 +01:00
parent e0dd6eb4a4
commit df6014894b
No known key found for this signature in database
34 changed files with 222 additions and 209 deletions

View file

@ -815,9 +815,9 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
* curl_easy_perform() is the external interface that performs a blocking
* transfer as previously setup.
*/
CURLcode curl_easy_perform(CURL *data)
CURLcode curl_easy_perform(CURL *curl)
{
return easy_perform(data, FALSE);
return easy_perform(curl, FALSE);
}
#ifdef DEBUGBUILD
@ -825,9 +825,9 @@ CURLcode curl_easy_perform(CURL *data)
* curl_easy_perform_ev() is the external interface that performs a blocking
* transfer using the event-based API internally.
*/
CURLcode curl_easy_perform_ev(struct Curl_easy *data)
CURLcode curl_easy_perform_ev(struct Curl_easy *easy)
{
return easy_perform(data, TRUE);
return easy_perform(easy, TRUE);
}
#endif
@ -835,9 +835,9 @@ CURLcode curl_easy_perform_ev(struct Curl_easy *data)
* curl_easy_cleanup() is the external interface to cleaning/freeing the given
* easy handle.
*/
void curl_easy_cleanup(CURL *ptr)
void curl_easy_cleanup(CURL *curl)
{
struct Curl_easy *data = ptr;
struct Curl_easy *data = curl;
if(GOOD_EASY_HANDLE(data)) {
struct Curl_sigpipe_ctx sigpipe_ctx;
sigpipe_ignore(data, &sigpipe_ctx);
@ -851,9 +851,9 @@ void curl_easy_cleanup(CURL *ptr)
* information from a performed transfer and similar.
*/
#undef curl_easy_getinfo
CURLcode curl_easy_getinfo(CURL *easy, CURLINFO info, ...)
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
{
struct Curl_easy *data = easy;
struct Curl_easy *data = curl;
va_list arg;
void *paramp;
CURLcode result;
@ -950,9 +950,9 @@ static void dupeasy_meta_freeentry(void *p)
* given input easy handle. The returned handle will be a new working handle
* with all options set exactly as the input source handle.
*/
CURL *curl_easy_duphandle(CURL *d)
CURL *curl_easy_duphandle(CURL *curl)
{
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
struct Curl_easy *outcurl = NULL;
if(!GOOD_EASY_HANDLE(data))
@ -1081,9 +1081,9 @@ fail:
* curl_easy_reset() is an external interface that allows an app to re-
* initialize a session handle to the default values.
*/
void curl_easy_reset(CURL *d)
void curl_easy_reset(CURL *curl)
{
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
if(!GOOD_EASY_HANDLE(data))
return;
@ -1130,12 +1130,12 @@ void curl_easy_reset(CURL *d)
* NOTE: This is one of few API functions that are allowed to be called from
* within a callback.
*/
CURLcode curl_easy_pause(CURL *d, int action)
CURLcode curl_easy_pause(CURL *curl, int action)
{
CURLcode result = CURLE_OK;
bool recursive = FALSE;
bool changed = FALSE;
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
bool recv_paused, recv_paused_new;
bool send_paused, send_paused_new;
@ -1220,11 +1220,11 @@ static CURLcode easy_connection(struct Curl_easy *data,
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
* Returns CURLE_OK on success, error code on error.
*/
CURLcode curl_easy_recv(CURL *d, void *buffer, size_t buflen, size_t *n)
CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n)
{
CURLcode result;
struct connectdata *c;
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
@ -1298,11 +1298,12 @@ CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer,
* Sends data over the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURLcode curl_easy_send(CURL *d, const void *buffer, size_t buflen, size_t *n)
CURLcode curl_easy_send(CURL *curl, const void *buffer, size_t buflen,
size_t *n)
{
size_t written = 0;
CURLcode result;
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
if(Curl_is_in_callback(data))
@ -1316,9 +1317,9 @@ CURLcode curl_easy_send(CURL *d, const void *buffer, size_t buflen, size_t *n)
/*
* Performs connection upkeep for the given session handle.
*/
CURLcode curl_easy_upkeep(CURL *d)
CURLcode curl_easy_upkeep(CURL *curl)
{
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
/* Verify that we got an easy handle we can work with. */
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
@ -1330,18 +1331,18 @@ CURLcode curl_easy_upkeep(CURL *d)
return Curl_cpool_upkeep(data);
}
CURLcode curl_easy_ssls_import(CURL *d, const char *session_key,
CURLcode curl_easy_ssls_import(CURL *curl, const char *session_key,
const unsigned char *shmac, size_t shmac_len,
const unsigned char *sdata, size_t sdata_len)
{
#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
return Curl_ssl_session_import(data, session_key,
shmac, shmac_len, sdata, sdata_len);
#else
(void)d;
(void)curl;
(void)session_key;
(void)shmac;
(void)shmac_len;
@ -1351,17 +1352,17 @@ CURLcode curl_easy_ssls_import(CURL *d, const char *session_key,
#endif
}
CURLcode curl_easy_ssls_export(CURL *d,
CURLcode curl_easy_ssls_export(CURL *curl,
curl_ssls_export_cb *export_fn,
void *userptr)
{
#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
return Curl_ssl_session_export(data, export_fn, userptr);
#else
(void)d;
(void)curl;
(void)export_fn;
(void)userptr;
return CURLE_NOT_BUILT_IN;