From 05ddf5511ac765c8fc4eb44507ab7c585116f665 Mon Sep 17 00:00:00 2001 From: Anton Karpov Date: Mon, 10 Aug 2026 00:48:09 +0300 Subject: [PATCH] headers: name the arguments the way the definitions name them Eleven arguments are named one way in the header and another in the definition. the compiler only checks types so nothing is broken, but the header is what people read first, and then the name changes under them in the source: ``` curl_dbg_malloc size -> wantedsize curl_dbg_calloc n, size -> wanted_elements, wanted_size curl_dbg_realloc size -> wantedsize curl_dbg_strdup src -> source r_freeaddrinfo res -> cahead my_get_line fp, db -> input, buf curl_slist_append_ccsid l -> list curl_version_info_ccsid cid -> ccsid curl_easy_setopt_ccsid curl -> easy ``` Follow-up to df6014894b789768b139fff27e8aed9dbc46ed79 #20794 Closes #22550 --- lib/curl_setup.h | 10 ++++++---- lib/fake_addrinfo.h | 2 +- projects/OS400/ccsidcurl.c | 14 +++++++------- projects/OS400/ccsidcurl.h | 7 ++++--- src/tool_parsecfg.h | 2 +- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/curl_setup.h b/lib/curl_setup.h index d43baf3b38..5924d54c05 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -1373,13 +1373,15 @@ extern FILE *curl_dbg_logfile; /* memory functions */ CURL_EXTERN void curl_dbg_free(void *ptr, int line, const char *source); CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1) - void *curl_dbg_malloc(size_t size, int line, const char *source); + void *curl_dbg_malloc(size_t wantedsize, int line, const char *source); CURL_EXTERN ALLOC_FUNC ALLOC_SIZE2(1, 2) - void *curl_dbg_calloc(size_t n, size_t size, int line, const char *source); + void *curl_dbg_calloc(size_t wanted_elements, size_t wanted_size, + int line, const char *source); CURL_EXTERN ALLOC_SIZE(2) - void *curl_dbg_realloc(void *ptr, size_t size, int line, const char *source); + void *curl_dbg_realloc(void *ptr, size_t wantedsize, int line, + const char *source); CURL_EXTERN ALLOC_FUNC - char *curl_dbg_strdup(const char *str, int line, const char *src); + char *curl_dbg_strdup(const char *str, int line, const char *source); #if defined(_WIN32) && defined(UNICODE) CURL_EXTERN ALLOC_FUNC wchar_t *curl_dbg_wcsdup(const wchar_t *str, int line, const char *source); diff --git a/lib/fake_addrinfo.h b/lib/fake_addrinfo.h index 07d5b6da8c..69579da2e5 100644 --- a/lib/fake_addrinfo.h +++ b/lib/fake_addrinfo.h @@ -43,7 +43,7 @@ # include #endif -void r_freeaddrinfo(struct addrinfo *res); +void r_freeaddrinfo(struct addrinfo *cahead); int r_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, diff --git a/projects/OS400/ccsidcurl.c b/projects/OS400/ccsidcurl.c index 1dcf9543f9..d6ad035b29 100644 --- a/projects/OS400/ccsidcurl.c +++ b/projects/OS400/ccsidcurl.c @@ -1018,7 +1018,7 @@ int curl_formget_ccsid(struct curl_httppost *form, void *arg, return curl_formget(form, (void *)&lcfc, Curl_formget_callback_ccsid); } -CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...) +CURLcode curl_easy_setopt_ccsid(CURL *curl, CURLoption tag, ...) { CURLcode result; va_list arg; @@ -1026,7 +1026,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...) char *cp = NULL; unsigned int ccsid; curl_off_t pfsize; - struct Curl_easy *data = easy; + struct Curl_easy *data = curl; va_start(arg, tag); @@ -1143,7 +1143,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...) } } - result = curl_easy_setopt(easy, tag, s); + result = curl_easy_setopt(curl, tag, s); free(s); break; @@ -1157,7 +1157,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...) pfsize = data->set.postfieldsize; if(!s || !pfsize || ccsid == NOCONV_CCSID || ccsid == ASCII_CCSID) { - result = curl_easy_setopt(easy, CURLOPT_COPYPOSTFIELDS, s); + result = curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, s); break; } @@ -1204,7 +1204,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...) cp = NULL; } - result = curl_easy_setopt(easy, CURLOPT_POSTFIELDS, s); + result = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, s); data->set.str[STRING_COPYPOSTFIELDS] = s; /* Give to library. */ break; @@ -1241,12 +1241,12 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...) blob.flags = bp->flags | CURL_BLOB_COPY; bp = &blob; } - result = curl_easy_setopt(easy, tag, bp); + result = curl_easy_setopt(curl, tag, bp); break; } FALLTHROUGH(); case CURLOPT_ERRORBUFFER: /* This is an output buffer. */ - result = Curl_vsetopt(easy, tag, arg); + result = Curl_vsetopt(curl, tag, arg); break; } diff --git a/projects/OS400/ccsidcurl.h b/projects/OS400/ccsidcurl.h index f9e667a9e4..f38e57967c 100644 --- a/projects/OS400/ccsidcurl.h +++ b/projects/OS400/ccsidcurl.h @@ -37,13 +37,14 @@ CURL_EXTERN char *curl_easy_unescape_ccsid(CURL *handle, const char *string, int length, int *outlength, unsigned int sccsid, unsigned int dccsid); -CURL_EXTERN struct curl_slist *curl_slist_append_ccsid(struct curl_slist *l, +CURL_EXTERN struct curl_slist *curl_slist_append_ccsid(struct curl_slist *list, const char *data, unsigned int ccsid); CURL_EXTERN time_t curl_getdate_ccsid(const char *p, const time_t *unused, unsigned int ccsid); -CURL_EXTERN curl_version_info_data *curl_version_info_ccsid(CURLversion stamp, - unsigned int cid); +CURL_EXTERN curl_version_info_data *curl_version_info_ccsid( + CURLversion stamp, + unsigned int ccsid); CURL_EXTERN const char *curl_easy_strerror_ccsid(CURLcode error, unsigned int ccsid); CURL_EXTERN const char *curl_share_strerror_ccsid(CURLSHcode error, diff --git a/src/tool_parsecfg.h b/src/tool_parsecfg.h index 860b9df38e..54e826fd10 100644 --- a/src/tool_parsecfg.h +++ b/src/tool_parsecfg.h @@ -29,6 +29,6 @@ #define CONFIG_MAX_LEVELS 5 ParameterError parseconfig(const char *filename, int max_recursive, char **resolved); -bool my_get_line(FILE *fp, struct dynbuf *db, bool *error); +bool my_get_line(FILE *input, struct dynbuf *buf, bool *error); #endif /* HEADER_CURL_TOOL_PARSECFG_H */