From: Tal Regev Date: Tue, 30 Jul 2024 03:07:50 +0000 (+0300) Subject: vtls: avoid forward declaration in MultiSSL builds X-Git-Tag: curl-8_9_1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98da147b18fa4963efb425df8400ca40e7526646;p=thirdparty%2Fcurl.git vtls: avoid forward declaration in MultiSSL builds The MSVC compiler cannot have forward declaration with const and static variable, causing this error: ``` curl\lib\vtls\vtls.c(417,44): warning C4132: 'Curl_ssl_multi': const object should be initialized ``` Ref: #14276 Closes #14305 --- diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 96e7197d45..e601f4b16e 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -413,23 +413,6 @@ int Curl_ssl_init(void) return Curl_ssl->init(); } -#if defined(CURL_WITH_MULTI_SSL) -static const struct Curl_ssl Curl_ssl_multi; -#endif - -/* Global cleanup */ -void Curl_ssl_cleanup(void) -{ - if(init_ssl) { - /* only cleanup if we did a previous init */ - Curl_ssl->cleanup(); -#if defined(CURL_WITH_MULTI_SSL) - Curl_ssl = &Curl_ssl_multi; -#endif - init_ssl = FALSE; - } -} - static bool ssl_prefs_check(struct Curl_easy *data) { /* check for CURLOPT_SSLVERSION invalid parameter value */ @@ -1404,6 +1387,19 @@ static const struct Curl_ssl *available_backends[] = { NULL }; +/* Global cleanup */ +void Curl_ssl_cleanup(void) +{ + if(init_ssl) { + /* only cleanup if we did a previous init */ + Curl_ssl->cleanup(); +#if defined(CURL_WITH_MULTI_SSL) + Curl_ssl = &Curl_ssl_multi; +#endif + init_ssl = FALSE; + } +} + static size_t multissl_version(char *buffer, size_t size) { static const struct Curl_ssl *selected;