curl: make global truly global

The GlobalConfig only exists in a single instance and it has worked like
this since the dawn of time. It is about time we stop passing around
pointers to what was already essentially a global object and instead
just use a... global.

It simplifies things.

Closes #18213
This commit is contained in:
Daniel Stenberg 2025-08-06 23:18:46 +02:00
parent 2d9f24bf24
commit 3b40128b0f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
42 changed files with 473 additions and 626 deletions

View file

@ -76,60 +76,55 @@ extern const struct NameValueUnsigned setopt_nv_CURLHSTS[];
/* Intercept setopt calls for --libcurl */
CURLcode tool_setopt_enum(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag,
CURLcode tool_setopt_enum(CURL *curl, const char *name, CURLoption tag,
const struct NameValue *nv, long lval);
CURLcode tool_setopt_SSLVERSION(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag,
CURLcode tool_setopt_SSLVERSION(CURL *curl, const char *name, CURLoption tag,
long lval);
CURLcode tool_setopt_flags(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag,
const struct NameValue *nv, long lval);
CURLcode tool_setopt_bitmask(CURL *curl, struct OperationConfig *config,
CURLcode tool_setopt_bitmask(CURL *curl,
const char *name, CURLoption tag,
const struct NameValueUnsigned *nv, long lval);
CURLcode tool_setopt_mimepost(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag,
curl_mime *mimepost);
CURLcode tool_setopt_slist(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag,
CURLcode tool_setopt_slist(CURL *curl, const char *name, CURLoption tag,
struct curl_slist *list);
CURLcode tool_setopt_long(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag,
CURLcode tool_setopt_long(CURL *curl, const char *name, CURLoption tag,
long lval);
CURLcode tool_setopt_offt(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag,
CURLcode tool_setopt_offt(CURL *curl, const char *name, CURLoption tag,
curl_off_t lval);
CURLcode tool_setopt(CURL *curl, bool str,
struct OperationConfig *config,
const char *name, CURLoption tag, ...);
CURLcode tool_setopt(CURL *curl, struct OperationConfig *config,
bool str, const char *name, CURLoption tag,
...);
#define my_setopt(x,y,z) \
tool_setopt(x, FALSE, config, #y, y, z)
tool_setopt(x, config, FALSE, #y, y, z)
#define my_setopt_long(x,y,z) \
tool_setopt_long(x, config, #y, y, z)
tool_setopt_long(x, #y, y, z)
#define my_setopt_offt(x,y,z) \
tool_setopt_offt(x, config, #y, y, z)
tool_setopt_offt(x, #y, y, z)
#define my_setopt_str(x,y,z) \
tool_setopt(x, TRUE, config, #y, y, z)
tool_setopt(x, config, TRUE, #y, y, z)
#define my_setopt_enum(x,y,z) \
tool_setopt_enum(x, config, #y, y, setopt_nv_ ## y, z)
tool_setopt_enum(x, #y, y, setopt_nv_ ## y, z)
#define my_setopt_SSLVERSION(x,y,z) \
tool_setopt_SSLVERSION(x, config, #y, y, z)
tool_setopt_SSLVERSION(x, #y, y, z)
#define my_setopt_bitmask(x,y,z) \
tool_setopt_bitmask(x, config, #y, y, setopt_nv_ ## y, z)
tool_setopt_bitmask(x, #y, y, setopt_nv_ ## y, z)
#define my_setopt_mimepost(x,y,z) \
tool_setopt_mimepost(x, config, #y, y, z)
#define my_setopt_slist(x,y,z) \
tool_setopt_slist(x, config, #y, y, z)
tool_setopt_slist(x, #y, y, z)
#else /* CURL_DISABLE_LIBCURL_OPTION */