mirror of
https://github.com/curl/curl.git
synced 2026-08-24 23:23:32 +03:00
tool: rename curl handle and result variable in --libcurl-generated code
To match documentation, examples and curl source code: - `hnd` -> `curl` - `ret` -> `result` Closes #20437
This commit is contained in:
parent
fa6a46473e
commit
2f8c9812b1
13 changed files with 182 additions and 182 deletions
|
|
@ -50,8 +50,8 @@ static const char * const srchead[] = {
|
|||
"",
|
||||
"int main(int argc, char *argv[])",
|
||||
"{",
|
||||
" CURLcode ret;",
|
||||
" CURL *hnd;",
|
||||
" CURLcode result;",
|
||||
" CURL *curl;",
|
||||
NULL
|
||||
};
|
||||
/* easysrc_decl declarations come here */
|
||||
|
|
@ -66,7 +66,7 @@ static const char * const srchard[] = {
|
|||
};
|
||||
static const char *const srcend[] = {
|
||||
"",
|
||||
" return (int)ret;",
|
||||
" return (int)result;",
|
||||
"}",
|
||||
"/**** End of sample code ****/",
|
||||
NULL
|
||||
|
|
@ -121,7 +121,7 @@ CURLcode easysrc_addf(struct slist_wc **plist, const char *fmt, ...)
|
|||
|
||||
CURLcode easysrc_init(void)
|
||||
{
|
||||
return easysrc_add(&easysrc_code, "hnd = curl_easy_init();");
|
||||
return easysrc_add(&easysrc_code, "curl = curl_easy_init();");
|
||||
}
|
||||
|
||||
CURLcode easysrc_perform(void)
|
||||
|
|
@ -152,7 +152,7 @@ CURLcode easysrc_perform(void)
|
|||
if(!result)
|
||||
result = easysrc_add(&easysrc_code, "");
|
||||
if(!result)
|
||||
result = easysrc_add(&easysrc_code, "ret = curl_easy_perform(hnd);");
|
||||
result = easysrc_add(&easysrc_code, "result = curl_easy_perform(curl);");
|
||||
if(!result)
|
||||
result = easysrc_add(&easysrc_code, "");
|
||||
|
||||
|
|
@ -161,9 +161,9 @@ CURLcode easysrc_perform(void)
|
|||
|
||||
CURLcode easysrc_cleanup(void)
|
||||
{
|
||||
CURLcode result = easysrc_add(&easysrc_code, "curl_easy_cleanup(hnd);");
|
||||
CURLcode result = easysrc_add(&easysrc_code, "curl_easy_cleanup(curl);");
|
||||
if(!result)
|
||||
result = easysrc_add(&easysrc_code, "hnd = NULL;");
|
||||
result = easysrc_add(&easysrc_code, "curl = NULL;");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,12 +253,12 @@ CURLcode tool_setopt_enum(CURL *curl, const char *name, CURLoption tag,
|
|||
/* If no definition was found, output an explicit value.
|
||||
* This could happen if new values are defined and used
|
||||
* but the NameValue list is not updated. */
|
||||
result = easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, %ldL);",
|
||||
result = easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, %ldL);",
|
||||
name, lval);
|
||||
}
|
||||
else
|
||||
result =
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, (long)%s);",
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, (long)%s);",
|
||||
name, nv->name);
|
||||
}
|
||||
|
||||
|
|
@ -296,19 +296,19 @@ CURLcode tool_setopt_SSLVERSION(CURL *curl, const char *name, CURLoption tag,
|
|||
/* If no definition was found, output an explicit value.
|
||||
* This could happen if new values are defined and used
|
||||
* but the NameValue list is not updated. */
|
||||
result = easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, %ldL);",
|
||||
result = easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, %ldL);",
|
||||
name, lval);
|
||||
}
|
||||
else {
|
||||
if(nv2->name && *nv2->name)
|
||||
/* if max is set */
|
||||
result = easysrc_addf(&easysrc_code,
|
||||
"curl_easy_setopt(hnd, %s, (long)(%s | %s));",
|
||||
"curl_easy_setopt(curl, %s, (long)(%s | %s));",
|
||||
name, nv->name, nv2->name);
|
||||
else
|
||||
/* without a max */
|
||||
result = easysrc_addf(&easysrc_code,
|
||||
"curl_easy_setopt(hnd, %s, (long)%s);",
|
||||
"curl_easy_setopt(curl, %s, (long)%s);",
|
||||
name, nv->name);
|
||||
}
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, const char *name, CURLoption tag,
|
|||
unsigned long rest = (unsigned long)lval;
|
||||
const struct NameValueUnsigned *nv = NULL;
|
||||
curl_msnprintf(preamble, sizeof(preamble),
|
||||
"curl_easy_setopt(hnd, %s, ", name);
|
||||
"curl_easy_setopt(curl, %s, ", name);
|
||||
for(nv = nvlist; nv->name; nv++) {
|
||||
if((nv->value & ~rest) == 0) {
|
||||
/* all value flags contained in rest */
|
||||
|
|
@ -533,7 +533,7 @@ static CURLcode libcurl_generate_mime(CURL *curl,
|
|||
if(!result)
|
||||
result = easysrc_addf(&easysrc_data, "mime%d = NULL;", *mimeno);
|
||||
if(!result)
|
||||
result = easysrc_addf(&easysrc_code, "mime%d = curl_mime_init(hnd);",
|
||||
result = easysrc_addf(&easysrc_code, "mime%d = curl_mime_init(curl);",
|
||||
*mimeno);
|
||||
if(!result)
|
||||
result = easysrc_addf(&easysrc_clean, "curl_mime_free(mime%d);", *mimeno);
|
||||
|
|
@ -563,7 +563,7 @@ CURLcode tool_setopt_mimepost(CURL *curl, struct OperationConfig *config,
|
|||
|
||||
if(!result)
|
||||
result =
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, mime%d);",
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, mime%d);",
|
||||
name, mimeno);
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +584,7 @@ CURLcode tool_setopt_slist(CURL *curl, const char *name, CURLoption tag,
|
|||
result = libcurl_generate_slist(list, &i);
|
||||
if(!result)
|
||||
result =
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, slist%d);",
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, slist%d);",
|
||||
name, i);
|
||||
}
|
||||
|
||||
|
|
@ -610,7 +610,7 @@ CURLcode tool_setopt_long(CURL *curl, const char *name, CURLoption tag,
|
|||
result = curl_easy_setopt(curl, tag, lval);
|
||||
if((lval != defval) && global->libcurl && !result) {
|
||||
/* we only use this for real if --libcurl was used */
|
||||
result = easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, %ldL);",
|
||||
result = easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, %ldL);",
|
||||
name, lval);
|
||||
}
|
||||
return result;
|
||||
|
|
@ -627,7 +627,7 @@ CURLcode tool_setopt_offt(CURL *curl, const char *name, CURLoption tag,
|
|||
if(global->libcurl && !result && lval) {
|
||||
/* we only use this for real if --libcurl was used */
|
||||
result =
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, (curl_off_t)%"
|
||||
easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, (curl_off_t)%"
|
||||
CURL_FORMAT_CURL_OFF_T ");", name, lval);
|
||||
}
|
||||
|
||||
|
|
@ -690,7 +690,7 @@ CURLcode tool_setopt_str(CURL *curl, struct OperationConfig *config,
|
|||
escaped = c_escape(str, len);
|
||||
if(escaped) {
|
||||
result = easysrc_addf(&easysrc_code,
|
||||
"curl_easy_setopt(hnd, %s, \"%s\");",
|
||||
"curl_easy_setopt(curl, %s, \"%s\");",
|
||||
name, escaped);
|
||||
curlx_free(escaped);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue