Skip to content

Commit 05ddf55

Browse files
karpovantonmevszakats
authored andcommitted
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 df60148 #20794 Closes #22550
1 parent 406edd0 commit 05ddf55

5 files changed

Lines changed: 19 additions & 16 deletions

File tree

‎lib/curl_setup.h‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,13 +1373,15 @@ extern FILE *curl_dbg_logfile;
13731373
/* memory functions */
13741374
CURL_EXTERN void curl_dbg_free(void *ptr, int line, const char *source);
13751375
CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1)
1376-
void *curl_dbg_malloc(size_t size, int line, const char *source);
1376+
void *curl_dbg_malloc(size_t wantedsize, int line, const char *source);
13771377
CURL_EXTERN ALLOC_FUNC ALLOC_SIZE2(1, 2)
1378-
void *curl_dbg_calloc(size_t n, size_t size, int line, const char *source);
1378+
void *curl_dbg_calloc(size_t wanted_elements, size_t wanted_size,
1379+
int line, const char *source);
13791380
CURL_EXTERN ALLOC_SIZE(2)
1380-
void *curl_dbg_realloc(void *ptr, size_t size, int line, const char *source);
1381+
void *curl_dbg_realloc(void *ptr, size_t wantedsize, int line,
1382+
const char *source);
13811383
CURL_EXTERN ALLOC_FUNC
1382-
char *curl_dbg_strdup(const char *str, int line, const char *src);
1384+
char *curl_dbg_strdup(const char *str, int line, const char *source);
13831385
#if defined(_WIN32) && defined(UNICODE)
13841386
CURL_EXTERN ALLOC_FUNC
13851387
wchar_t *curl_dbg_wcsdup(const wchar_t *str, int line, const char *source);

‎lib/fake_addrinfo.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# include <arpa/inet.h>
4444
#endif
4545

46-
void r_freeaddrinfo(struct addrinfo *res);
46+
void r_freeaddrinfo(struct addrinfo *cahead);
4747
int r_getaddrinfo(const char *node,
4848
const char *service,
4949
const struct addrinfo *hints,

‎projects/OS400/ccsidcurl.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,15 +1018,15 @@ int curl_formget_ccsid(struct curl_httppost *form, void *arg,
10181018
return curl_formget(form, (void *)&lcfc, Curl_formget_callback_ccsid);
10191019
}
10201020

1021-
CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...)
1021+
CURLcode curl_easy_setopt_ccsid(CURL *curl, CURLoption tag, ...)
10221022
{
10231023
CURLcode result;
10241024
va_list arg;
10251025
char *s;
10261026
char *cp = NULL;
10271027
unsigned int ccsid;
10281028
curl_off_t pfsize;
1029-
struct Curl_easy *data = easy;
1029+
struct Curl_easy *data = curl;
10301030

10311031
va_start(arg, tag);
10321032

@@ -1143,7 +1143,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...)
11431143
}
11441144
}
11451145

1146-
result = curl_easy_setopt(easy, tag, s);
1146+
result = curl_easy_setopt(curl, tag, s);
11471147
free(s);
11481148
break;
11491149

@@ -1157,7 +1157,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...)
11571157
pfsize = data->set.postfieldsize;
11581158

11591159
if(!s || !pfsize || ccsid == NOCONV_CCSID || ccsid == ASCII_CCSID) {
1160-
result = curl_easy_setopt(easy, CURLOPT_COPYPOSTFIELDS, s);
1160+
result = curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, s);
11611161
break;
11621162
}
11631163

@@ -1204,7 +1204,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...)
12041204
cp = NULL;
12051205
}
12061206

1207-
result = curl_easy_setopt(easy, CURLOPT_POSTFIELDS, s);
1207+
result = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, s);
12081208
data->set.str[STRING_COPYPOSTFIELDS] = s; /* Give to library. */
12091209
break;
12101210

@@ -1241,12 +1241,12 @@ CURLcode curl_easy_setopt_ccsid(CURL *easy, CURLoption tag, ...)
12411241
blob.flags = bp->flags | CURL_BLOB_COPY;
12421242
bp = &blob;
12431243
}
1244-
result = curl_easy_setopt(easy, tag, bp);
1244+
result = curl_easy_setopt(curl, tag, bp);
12451245
break;
12461246
}
12471247
FALLTHROUGH();
12481248
case CURLOPT_ERRORBUFFER: /* This is an output buffer. */
1249-
result = Curl_vsetopt(easy, tag, arg);
1249+
result = Curl_vsetopt(curl, tag, arg);
12501250
break;
12511251
}
12521252

‎projects/OS400/ccsidcurl.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ CURL_EXTERN char *curl_easy_unescape_ccsid(CURL *handle, const char *string,
3737
int length, int *outlength,
3838
unsigned int sccsid,
3939
unsigned int dccsid);
40-
CURL_EXTERN struct curl_slist *curl_slist_append_ccsid(struct curl_slist *l,
40+
CURL_EXTERN struct curl_slist *curl_slist_append_ccsid(struct curl_slist *list,
4141
const char *data,
4242
unsigned int ccsid);
4343
CURL_EXTERN time_t curl_getdate_ccsid(const char *p, const time_t *unused,
4444
unsigned int ccsid);
45-
CURL_EXTERN curl_version_info_data *curl_version_info_ccsid(CURLversion stamp,
46-
unsigned int cid);
45+
CURL_EXTERN curl_version_info_data *curl_version_info_ccsid(
46+
CURLversion stamp,
47+
unsigned int ccsid);
4748
CURL_EXTERN const char *curl_easy_strerror_ccsid(CURLcode error,
4849
unsigned int ccsid);
4950
CURL_EXTERN const char *curl_share_strerror_ccsid(CURLSHcode error,

‎src/tool_parsecfg.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
#define CONFIG_MAX_LEVELS 5
3030
ParameterError parseconfig(const char *filename, int max_recursive,
3131
char **resolved);
32-
bool my_get_line(FILE *fp, struct dynbuf *db, bool *error);
32+
bool my_get_line(FILE *input, struct dynbuf *buf, bool *error);
3333

3434
#endif /* HEADER_CURL_TOOL_PARSECFG_H */

0 commit comments

Comments
 (0)