mirror of
https://github.com/curl/curl.git
synced 2026-08-25 08:53:36 +03:00
tool_operate: move config2setopts to separate file, split into subs
To decrease size and complexity. Complexity taken down from 190 to 80. Bonus: - remove leftover HTTP/0.9 warning never triggered since hyper was dropped - remove the ftp-skip-ip option unless FTP is used - only set HTTP options if HTTP(S) is used - remove use of the pointless SETOPT_CHECK macro Side-effect: - The order of the options in --libcurl is modified Closes #17352
This commit is contained in:
parent
9c8cbbda5b
commit
f97d372703
16 changed files with 1225 additions and 1101 deletions
|
|
@ -31,10 +31,6 @@
|
|||
* Macros used in operate()
|
||||
*/
|
||||
|
||||
#define SETOPT_CHECK(v,opt) do { \
|
||||
result = (v); \
|
||||
} while(0)
|
||||
|
||||
#ifndef CURL_DISABLE_LIBCURL_OPTION
|
||||
|
||||
/* Associate symbolic names with option values */
|
||||
|
|
@ -108,70 +104,62 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *global,
|
|||
const char *name, CURLoption tag, ...);
|
||||
|
||||
#define my_setopt(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt(x, FALSE, global, config, #y, y, z), y)
|
||||
tool_setopt(x, FALSE, global, config, #y, y, z)
|
||||
|
||||
#define my_setopt_long(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_long(x, global, #y, y, z), y)
|
||||
tool_setopt_long(x, global, #y, y, z)
|
||||
|
||||
#define my_setopt_offt(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_offt(x, global, #y, y, z), y)
|
||||
tool_setopt_offt(x, global, #y, y, z)
|
||||
|
||||
#define my_setopt_str(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt(x, TRUE, global, config, #y, y, z), y)
|
||||
tool_setopt(x, TRUE, global, config, #y, y, z)
|
||||
|
||||
#define my_setopt_enum(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_enum(x, global, #y, y, setopt_nv_ ## y, z), y)
|
||||
tool_setopt_enum(x, global, #y, y, setopt_nv_ ## y, z)
|
||||
|
||||
#define my_setopt_SSLVERSION(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_SSLVERSION(x, global, #y, y, z), y)
|
||||
tool_setopt_SSLVERSION(x, global, #y, y, z)
|
||||
|
||||
#define my_setopt_bitmask(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_bitmask(x, global, #y, y, setopt_nv_ ## y, z), y)
|
||||
tool_setopt_bitmask(x, global, #y, y, setopt_nv_ ## y, z)
|
||||
|
||||
#define my_setopt_mimepost(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_mimepost(x, global, #y, y, z), y)
|
||||
tool_setopt_mimepost(x, global, #y, y, z)
|
||||
|
||||
#define my_setopt_slist(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_slist(x, global, #y, y, z), y)
|
||||
|
||||
#define res_setopt(x,y,z) tool_setopt(x, FALSE, global, config, #y, y, z)
|
||||
|
||||
#define res_setopt_str(x,y,z) tool_setopt(x, TRUE, global, config, #y, y, z)
|
||||
tool_setopt_slist(x, global, #y, y, z)
|
||||
|
||||
#else /* CURL_DISABLE_LIBCURL_OPTION */
|
||||
|
||||
/* No --libcurl, so pass options directly to library */
|
||||
|
||||
#define my_setopt(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, z), y)
|
||||
curl_easy_setopt(x, y, z)
|
||||
|
||||
#define my_setopt_long(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, (long)(z)), y)
|
||||
curl_easy_setopt(x, y, (long)(z))
|
||||
|
||||
#define my_setopt_offt(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, (curl_off_t)(z)), y)
|
||||
curl_easy_setopt(x, y, (curl_off_t)(z))
|
||||
|
||||
#define my_setopt_str(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, z), y)
|
||||
curl_easy_setopt(x, y, z)
|
||||
|
||||
#define my_setopt_enum(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, z), y)
|
||||
curl_easy_setopt(x, y, z)
|
||||
|
||||
#define my_setopt_SSLVERSION(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, z), y)
|
||||
curl_easy_setopt(x, y, z)
|
||||
|
||||
#define my_setopt_bitmask(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, z), y)
|
||||
curl_easy_setopt(x, y, (long)z)
|
||||
|
||||
#define my_setopt_mimepost(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, z), y)
|
||||
curl_easy_setopt(x, y, z)
|
||||
|
||||
#define my_setopt_slist(x,y,z) \
|
||||
SETOPT_CHECK(curl_easy_setopt(x, y, z), y)
|
||||
|
||||
#define res_setopt(x,y,z) curl_easy_setopt(x,y,z)
|
||||
|
||||
#define res_setopt_str(x,y,z) curl_easy_setopt(x,y,z)
|
||||
curl_easy_setopt(x, y, z)
|
||||
|
||||
#endif /* CURL_DISABLE_LIBCURL_OPTION */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue