From 6fe9491b7e107eb0f3a30f792699c6ba820f58a8 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 13 Aug 2024 10:07:20 +0200 Subject: [PATCH] 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 --- compat/lazyload-curl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/compat/lazyload-curl.c b/compat/lazyload-curl.c index 9315b4a81f8192..2f2b2ebc27993e 100644 --- a/compat/lazyload-curl.c +++ b/compat/lazyload-curl.c @@ -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; @@ -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"); @@ -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();