Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazycurl: prepare for new upstream Git requirements #5102

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fixup! http: optionally load libcurl lazily
An upcoming change in Git wants it to call `curl_version_info()`, which
the lazy cURL stuff hereby learns about.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Aug 13, 2024
commit 6fe9491b7e107eb0f3a30f792699c6ba820f58a8
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
Loading