Skip to content

Commit

Permalink
lazycurl: prepare for new upstream Git requirements (git-for-windows#…
Browse files Browse the repository at this point in the history
…5102)

An [upcoming change in
Git](git@0ca365c)
wants it to call `curl_version_info()`, which the lazy cURL stuff hereby
learns about.
  • Loading branch information
dscho authored Aug 13, 2024
2 parents 28481d4 + 6fe9491 commit d1cf3f7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions compat/lazyload-curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ static func_t load_function(void *handle, const char *name)
}
#endif

typedef struct curl_version_info_data *(*curl_version_info_type)(CURLversion version);
static curl_version_info_type curl_version_info_func;

typedef char *(*curl_easy_escape_type)(CURL *handle, const char *string, int length);
static curl_easy_escape_type curl_easy_escape_func;

Expand Down Expand Up @@ -192,6 +195,7 @@ static void lazy_load_curl(void)
if (!libcurl)
die("failed to load library '%s'", LIBCURL_FILE_NAME("libcurl"));

curl_version_info_func = (curl_version_info_type)load_function(libcurl, "curl_version_info");
curl_easy_escape_func = (curl_easy_escape_type)load_function(libcurl, "curl_easy_escape");
curl_free_func = (curl_free_type)load_function(libcurl, "curl_free");
curl_global_init_func = (curl_global_init_type)load_function(libcurl, "curl_global_init");
Expand Down Expand Up @@ -225,6 +229,12 @@ static void lazy_load_curl(void)
curl_easy_setopt_off_t_func = (curl_easy_setopt_off_t_type)curl_easy_setopt_func;
}

struct curl_version_info_data *curl_version_info(CURLversion version)
{
lazy_load_curl();
return curl_version_info_func(version);
}

char *curl_easy_escape(CURL *handle, const char *string, int length)
{
lazy_load_curl();
Expand Down

0 comments on commit d1cf3f7

Please sign in to comment.