From: Viktor Szakats Date: Fri, 27 Jun 2025 07:03:24 +0000 (+0200) Subject: lib: replace scache no-op macros with `#ifdef` X-Git-Tag: curl-8_15_0~137 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=081e78b023b1fdd76f4a65a2305bc8a63bab1ba5;p=thirdparty%2Fcurl.git lib: replace scache no-op macros with `#ifdef` To avoid warning/error in no-SSL, non-unity builds: ``` lib/multi.c:273:5: error: code will never be executed [-Werror,-Wunreachable-code] 273 | goto error; | ^~~~~~~~~~ ``` Reported-by: Marcel Raad Fixes #17754 Closes #17760 --- diff --git a/lib/multi.c b/lib/multi.c index 5377bc8d15..2dc63852d3 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -271,20 +271,22 @@ struct Curl_multi *Curl_multi_handle(unsigned int xfer_table_size, Curl_cpool_init(&multi->cpool, multi->admin, NULL, chashsize); +#ifdef USE_SSL if(Curl_ssl_scache_create(sesssize, 2, &multi->ssl_scache)) goto error; +#else + (void)sesssize; +#endif #ifdef USE_WINSOCK multi->wsa_event = WSACreateEvent(); if(multi->wsa_event == WSA_INVALID_EVENT) goto error; -#else -#ifdef ENABLE_WAKEUP +#elif defined(ENABLE_WAKEUP) if(wakeup_create(multi->wakeup_pair, TRUE) < 0) { multi->wakeup_pair[0] = CURL_SOCKET_BAD; multi->wakeup_pair[1] = CURL_SOCKET_BAD; } -#endif #endif return multi; @@ -296,7 +298,9 @@ error: Curl_dnscache_destroy(&multi->dnscache); Curl_cpool_destroy(&multi->cpool); Curl_cshutdn_destroy(&multi->cshutdn, multi->admin); +#ifdef USE_SSL Curl_ssl_scache_destroy(multi->ssl_scache); +#endif if(multi->admin) { multi->admin->multi = NULL; Curl_close(&multi->admin); @@ -2849,7 +2853,9 @@ CURLMcode curl_multi_cleanup(CURLM *m) Curl_hash_destroy(&multi->proto_hash); Curl_dnscache_destroy(&multi->dnscache); Curl_psl_destroy(&multi->psl); +#ifdef USE_SSL Curl_ssl_scache_destroy(multi->ssl_scache); +#endif #ifdef USE_WINSOCK WSACloseEvent(multi->wsa_event); diff --git a/lib/vtls/vtls_scache.h b/lib/vtls/vtls_scache.h index eef50805e4..deedccfe8c 100644 --- a/lib/vtls/vtls_scache.h +++ b/lib/vtls/vtls_scache.h @@ -206,12 +206,6 @@ CURLcode Curl_ssl_session_export(struct Curl_easy *data, void *userptr); #endif /* USE_SSLS_EXPORT */ - -#else /* USE_SSL */ - -#define Curl_ssl_scache_create(x,y,z) ((void)x, CURLE_OK) -#define Curl_ssl_scache_destroy(x) do {} while(0) - -#endif /* USE_SSL (else) */ +#endif /* USE_SSL */ #endif /* HEADER_CURL_VTLS_SCACHE_H */